From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+6c7e68b141ebd3a2cadf@syzkaller.appspotmail.com
Subject: [PATCH] usb: typec: stusb160x: add missing NULL check for i2c_get_match_data()
Date: Thu, 6 Aug 2026 08:43:01 +0000 [thread overview]
Message-ID: <20260806084301.1340-1-joshua.crofts1@gmail.com> (raw)
In stusb160x_probe(), the return value of i2c_get_match_data() is not
checked, causing a null pointer dereference later on if the device was
registered manually (without devicetree or ACPI).
Fix this by adding a NULL check for the return value of
i2c_get_match_data().
Reported-by: syzbot+6c7e68b141ebd3a2cadf@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6c7e68b141ebd3a2cadf
Fixes: 823754697556 ("usb: typec: stusb160x: Make use of i2c_get_match_data()")
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
drivers/usb/typec/stusb160x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c
index 6d85b25b40bc..8f3435c669cd 100644
--- a/drivers/usb/typec/stusb160x.c
+++ b/drivers/usb/typec/stusb160x.c
@@ -645,6 +645,8 @@ static int stusb160x_probe(struct i2c_client *client)
i2c_set_clientdata(client, chip);
regmap_config = i2c_get_match_data(client);
+ if (!regmap_config)
+ return -ENODEV;
chip->regmap = devm_regmap_init_i2c(client, regmap_config);
if (IS_ERR(chip->regmap)) {
--
2.47.3
next reply other threads:[~2026-08-06 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 8:43 Joshua Crofts [this message]
2026-08-06 8:47 ` [PATCH] usb: typec: stusb160x: add missing NULL check for i2c_get_match_data() Joshua Crofts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260806084301.1340-1-joshua.crofts1@gmail.com \
--to=joshua.crofts1@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+6c7e68b141ebd3a2cadf@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox