The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+23cf45a9fce78e4e0dc1@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] usb: typec: ucsi_acpi: fix NULL pointer dereference in ucsi_acpi_probe()
Date: Fri, 21 Aug 2026 03:31:34 -0700	[thread overview]
Message-ID: <6a882906.ae6ddae5.3da009.0033.GAE@google.com> (raw)
In-Reply-To: <6a8818d8.ae6ddae5.3da009.0030.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] usb: typec: ucsi_acpi: fix NULL pointer dereference in ucsi_acpi_probe()
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


ucsi_acpi_probe() dereferences the ACPI companion device pointer
returned by ACPI_COMPANION() without checking it for NULL. While
this driver is normally probed through ACPI device enumeration
where a companion is always present, a platform_device can also be
manually bound to any platform driver via the sysfs 'bind' file
(bind_store() -> bus_find_device() -> driver_attach_device()),
which matches purely on device name and bypasses ACPI matching.

If ucsi_acpi is bound this way to a platform device with no ACPI
companion, ACPI_COMPANION() returns NULL and the subsequent
adev->dep_unmet access dereferences a NULL pointer, resulting in a
general protection fault.

Add a NULL check for adev immediately after it is obtained and
before any resource allocation, returning -ENODEV to decline
binding cleanly.

Reported-by: syzbot+23cf45a9fce78e4e0dc1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=23cf45a9fce78e4e0dc1
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 drivers/usb/typec/ucsi/ucsi_acpi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 18286d3e9cc5..9fe4ba43afea 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -196,6 +196,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
 	acpi_status status;
 	int ret;
 
+	if (!adev)
+		return -ENODEV;
+
 	if (adev->dep_unmet)
 		return -EPROBE_DEFER;
 
-- 
2.34.1


      reply	other threads:[~2026-08-21 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  9:22 [syzbot] [usb?] general protection fault in ucsi_acpi_probe syzbot
2026-08-21 10:31 ` syzbot [this message]

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=6a882906.ae6ddae5.3da009.0033.GAE@google.com \
    --to=syzbot+23cf45a9fce78e4e0dc1@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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