Chrome platform driver development
 help / color / mirror / Atom feed
* [PATCH 0/2] platform/chrome: check ACPI companions before use
@ 2026-10-28  5:11 Jiale Yao
  2026-10-28  5:11 ` [PATCH 1/2] platform/chrome: cros_ec_uart: check ACPI companion " Jiale Yao
  2026-10-28  5:12 ` [PATCH 2/2] platform/chrome: cros_usbpd_notify: check ACPI companion Jiale Yao
  0 siblings, 2 replies; 6+ messages in thread
From: Jiale Yao @ 2026-10-28  5:11 UTC (permalink / raw)
  To: Bhanu Prakash Maiya, Benson Leung, Tzung-Bi Shih, Guenter Roeck,
	Łukasz Bartosik, Andrei Kuchynski, Jameson Thies,
	Mark Hasemeyer, Prashant Malani, Enric Balletbo i Serra,
	chrome-platform, linux-kernel

Two Chrome platform drivers assume their firmware-matched devices always
carry an ACPI companion. Driver override can bind either driver to a device
without one, leading probe to dereference a NULL companion.

Reject missing companions before passing them to ACPI resource and notify
handler APIs. Each change is independent and preserves the normal
firmware-matched probe path.

Jiale Yao (2):
  platform/chrome: cros_ec_uart: check ACPI companion before use
  platform/chrome: cros_usbpd_notify: check ACPI companion

 drivers/platform/chrome/cros_ec_uart.c      | 8 ++++++--
 drivers/platform/chrome/cros_usbpd_notify.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH 2/2] platform/chrome: cros_usbpd_notify: check ACPI companion
@ 2026-10-28  5:10 Jiale Yao
  0 siblings, 0 replies; 6+ messages in thread
From: Jiale Yao @ 2026-10-28  5:10 UTC (permalink / raw)
  To: Łukasz Bartosik, Andrei Kuchynski, Jameson Thies,
	Benson Leung, Tzung-Bi Shih, Enric Balletbo i Serra,
	Prashant Malani, chrome-platform, linux-kernel
  Cc: stable

The ACPI probe installs a notification handler through the device ACPI
companion without checking that the companion exists. A force-bound
platform device can therefore cause a NULL pointer dereference.

Return -ENODEV before allocating probe resources when the companion is
missing.

Fixes: 7e91e1ac60bb ("platform/chrome: cros_usbpd_notify: Amend ACPI driver to plat")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/platform/chrome/cros_usbpd_notify.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
index 25da31ec1996..1d82c74583cb 100644
--- a/drivers/platform/chrome/cros_usbpd_notify.c
+++ b/drivers/platform/chrome/cros_usbpd_notify.c
@@ -105,6 +105,8 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
 	acpi_status status;
 
 	adev = ACPI_COMPANION(dev);
+	if (!adev)
+		return -ENODEV;
 
 	pdnotify = devm_kzalloc(dev, sizeof(*pdnotify), GFP_KERNEL);
 	if (!pdnotify)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-29  3:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  5:11 [PATCH 0/2] platform/chrome: check ACPI companions before use Jiale Yao
2026-10-28  5:11 ` [PATCH 1/2] platform/chrome: cros_ec_uart: check ACPI companion " Jiale Yao
2026-10-29  3:20   ` Tzung-Bi Shih
2026-10-28  5:12 ` [PATCH 2/2] platform/chrome: cros_usbpd_notify: check ACPI companion Jiale Yao
2026-10-29  3:19   ` Tzung-Bi Shih
  -- strict thread matches above, loose matches on Subject: below --
2026-10-28  5:10 Jiale Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox