mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "jiale yao" <19888972804@163.com>
To: "Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re:[PATCH] usb: typec: ucsi: acpi: Check ACPI companion before use
Date: Sat, 17 Oct 2026 15:41:47 +0800 (CST)	[thread overview]
Message-ID: <2df74bd8.1902.1a148cf4a95.Coremail.19888972804@163.com> (raw)
In-Reply-To: <20261017064321.3816776-1-yaojiale02@163.com>

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

      reply	other threads:[~2026-10-17  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  6:43 [PATCH] " Jiale Yao
2026-10-17  7:41 ` jiale yao [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=2df74bd8.1902.1a148cf4a95.Coremail.19888972804@163.com \
    --to=19888972804@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®