[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250313162211.3650958-1-chenyuan0y@gmail.com>
Date: Thu, 13 Mar 2025 11:22:11 -0500
From: Chenyuan Yang <chenyuan0y@...il.com>
To: heikki.krogerus@...ux.intel.com,
gregkh@...uxfoundation.org,
lk@...e.de,
dmitry.baryshkov@...aro.org,
u.kleine-koenig@...libre.com,
diogo.ivo@...nico.ulisboa.pt,
saranya.gopal@...el.com
Cc: linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chenyuan Yang <chenyuan0y@...il.com>
Subject: [PATCH] usb: typec: ucsi: acpi: Add Null check for adev
Not all devices have an ACPI companion fwnode, so adev might be NULL.
This is similar to the commit cd2fd6eab480
("platform/x86: int3472: Check for adev == NULL").
Add a check for adev not being set and return -ENODEV in that case to
avoid a possible NULL pointer deref in ucsi_acpi_probe().
Signed-off-by: Chenyuan Yang <chenyuan0y@...il.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 ac1ebb5d9527..d517914c6439 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -189,6 +189,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
Powered by blists - more mailing lists