From: "jiale yao" <19888972804@163.com>
To: "Haiyang Zhang" <haiyangz@microsoft.com>,
"Wei Liu" <wei.liu@kernel.org>,
"Dexuan Cui" <decui@microsoft.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re:[PATCH] Drivers: hv: vmbus: Check ACPI companion before use
Date: Sat, 17 Oct 2026 15:40:45 +0800 (CST) [thread overview]
Message-ID: <3f41f884.18f3.1a148ce5a95.Coremail.19888972804@163.com> (raw)
In-Reply-To: <20261017064313.3816553-1-yaojiale02@163.com>
At 2026-10-17 14:43:13, "Jiale Yao" <yaojiale02@163.com> wrote:
>Platform drivers can be forced to bind to devices outside their match
>tables through driver_override. vmbus_acpi_add() assumes that every bound
>device has an ACPI companion and dereferences it without checking.
>
>Return -ENODEV when the companion is absent to avoid a NULL pointer
>dereference.
>
Fixes: 9c8434238041 ("Drivers: hv: vmbus: Convert acpi_device to more generic platform_device")
>Signed-off-by: Jiale Yao <yaojiale02@163.com>
>---
> drivers/hv/vmbus_drv.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
>index 4692687cdbf3..28f459679406 100644
>--- a/drivers/hv/vmbus_drv.c
>+++ b/drivers/hv/vmbus_drv.c
>@@ -2571,10 +2571,14 @@ EXPORT_SYMBOL_GPL(vmbus_free_mmio);
> #ifdef CONFIG_ACPI
> static int vmbus_acpi_add(struct platform_device *pdev)
> {
>+ struct acpi_device *ancestor;
>+ struct acpi_device *device;
> acpi_status result;
> int ret_val = -ENODEV;
>- struct acpi_device *ancestor;
>- struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
>+
>+ device = ACPI_COMPANION(&pdev->dev);
>+ if (!device)
>+ return -ENODEV;
>
> vmbus_root_device = &device->dev;
>
>--
>2.34.1
next prev parent reply other threads:[~2026-10-17 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 6:43 [PATCH] " Jiale Yao
2026-10-17 7:40 ` jiale yao [this message]
2026-10-19 9:24 ` Naman Jain
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=3f41f884.18f3.1a148ce5a95.Coremail.19888972804@163.com \
--to=19888972804@163.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wei.liu@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®