* [PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use
@ 2026-10-17 6:43 Jiale Yao
2026-10-17 6:44 ` sashiko-bot
2026-10-17 7:41 ` jiale yao
0 siblings, 2 replies; 3+ messages in thread
From: Jiale Yao @ 2026-10-17 6:43 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel; +Cc: Jiale Yao
Platform drivers can be forced to bind to devices outside their match
tables through driver_override. ucsi_acpi_probe() assumes that every bound
device has an ACPI companion and accesses adev->dep_unmet without checking.
Return -ENODEV when the companion is absent to avoid a NULL pointer
dereference.
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/usb/typec/ucsi/ucsi_acpi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 5697ccc24ec3..e8e3205cab9b 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -222,14 +222,18 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
static int ucsi_acpi_probe(struct platform_device *pdev)
{
- struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
const struct ucsi_operations *ops = &ucsi_acpi_ops;
const struct dmi_system_id *id;
+ struct acpi_device *adev;
struct ucsi_acpi *ua;
struct resource *res;
acpi_status status;
int ret;
+ adev = ACPI_COMPANION(&pdev->dev);
+ if (!adev)
+ return -ENODEV;
+
if (adev->dep_unmet)
return -EPROBE_DEFER;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use
2026-10-17 6:43 [PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use Jiale Yao
@ 2026-10-17 6:44 ` sashiko-bot
2026-10-17 7:41 ` jiale yao
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-10-17 6:44 UTC (permalink / raw)
To: Jiale Yao, linux-usb
> Platform drivers can be forced to bind to devices outside their match
> tables through driver_override. ucsi_acpi_probe() assumes that every bound
> device has an ACPI companion and accesses adev->dep_unmet without checking.
>
> Return -ENODEV when the companion is absent to avoid a NULL pointer
> dereference.
>
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261017064321.3816776-1-yaojiale02@163.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re:[PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use
2026-10-17 6:43 [PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use Jiale Yao
2026-10-17 6:44 ` sashiko-bot
@ 2026-10-17 7:41 ` jiale yao
1 sibling, 0 replies; 3+ messages in thread
From: jiale yao @ 2026-10-17 7:41 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel
At 2026-10-17 14:43:21, "Jiale Yao" <yaojiale02@163.com> wrote:
>Platform drivers can be forced to bind to devices outside their match
>tables through driver_override. ucsi_acpi_probe() assumes that every bound
>device has an ACPI companion and accesses adev->dep_unmet without checking.
>
>Return -ENODEV when the companion is absent to avoid a NULL pointer
>dereference.
>
Fixes: 1f3546ff3f0a ("usb: typec: ucsi: acpi: Check the _DEP dependencies")
>Signed-off-by: Jiale Yao <yaojiale02@163.com>
>---
> drivers/usb/typec/ucsi/ucsi_acpi.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
>index 5697ccc24ec3..e8e3205cab9b 100644
>--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
>+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
>@@ -222,14 +222,18 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
>
> static int ucsi_acpi_probe(struct platform_device *pdev)
> {
>- struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
> const struct ucsi_operations *ops = &ucsi_acpi_ops;
> const struct dmi_system_id *id;
>+ struct acpi_device *adev;
> struct ucsi_acpi *ua;
> struct resource *res;
> acpi_status status;
> int ret;
>
>+ adev = ACPI_COMPANION(&pdev->dev);
>+ if (!adev)
>+ return -ENODEV;
>+
> if (adev->dep_unmet)
> return -EPROBE_DEFER;
>
>--
>2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-17 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 6:43 [PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use Jiale Yao
2026-10-17 6:44 ` sashiko-bot
2026-10-17 7:41 ` jiale yao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox