mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Naman Jain <namjain@linux.microsoft.com>
To: Jiale Yao <yaojiale02@163.com>,
	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: Mon, 19 Oct 2026 14:54:13 +0530	[thread overview]
Message-ID: <65524c06-55e1-4340-b7a7-b038d20e6b74@linux.microsoft.com> (raw)
In-Reply-To: <20261017064313.3816553-1-yaojiale02@163.com>



On 10/17/2026 12:13 PM, Jiale Yao 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.
> 
> 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;
>   

Reviewed-by: Naman Jain <namjain@linux.microsoft.com>

Regards,
Naman

      parent reply	other threads:[~2026-10-19  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  6:43 Jiale Yao
2026-10-17  7:40 ` jiale yao
2026-10-19  9:24 ` Naman Jain [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=65524c06-55e1-4340-b7a7-b038d20e6b74@linux.microsoft.com \
    --to=namjain@linux.microsoft.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 \
    --cc=yaojiale02@163.com \
    /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®