public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Naman Jain <namjain@linux.microsoft.com>
To: "Ваторопин Андрей" <a.vatoropin@crpt.ru>,
	"K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Long Li <longli@microsoft.com>,
	Saurabh Sengar <ssengar@linux.microsoft.com>,
	Michael Kelley <mikelley@microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] Drivers: hv: vmbus: Fix potential NULL pointer dereference in vmbus_acpi_add()
Date: Tue, 10 Mar 2026 16:48:05 +0530	[thread overview]
Message-ID: <8d5360bb-eaf1-4325-acc7-5f3ccdb59dc2@linux.microsoft.com> (raw)
In-Reply-To: <20260310084140.473079-1-a.vatoropin@crpt.ru>



On 3/10/2026 2:12 PM, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin@crpt.ru>
> 
> The current driver supports detection via both the ACPI interface and the
> Device Tree interface (OF).
> 
> In the function vmbus_platform_driver_probe() upon driver detection via OF,
> the branch vmbus_device_add() should be executed.
> 
> However, the variable "acpi_disabled" is a global variable that, in general
> equals 0 when CONFIG_ACPI is enabled. Therefore, it may enter another
> branch with vmbus_acpi_add().
> 
> Therefore, in the function vmbus_acpi_add(), when the device is not ACPI,
> the ACPI_COMPANION macro may return a NULL value, and this pointer is then
> dereferenced.
> 
> Add a NULL pointer check for the "device" pointer before dereferencing it.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: f83705a51275 ("Driver: VMBus: Add Devicetree support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
> ---
>   drivers/hv/vmbus_drv.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index bc4fc1951ae1..c9ee3375b524 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -2571,6 +2571,9 @@ static int vmbus_acpi_add(struct platform_device *pdev)
>   	struct acpi_device *ancestor;
>   	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
>   
> +	if (!device)
> +		return -ENODEV;
> +
>   	vmbus_root_device = &device->dev;
>   
>   	/*

I understand the case we are trying to make here, but I tried 
reproducing this at my end, where we are probing VMBus using Devicetree, 
and CONFIG_ACPI is enabled and there is no "acpi=off" in kernel cmdline.
But still, when the control reaches this particular function - 
vmbus_platform_driver_probe(), acpi_disabled still shows up as 1 for me.
Can you please share your configuration how you are able to reproduce 
this issue.

Secondly, let's say this case happens, then while our fix prevents null 
pointer crash from happening, it does not fix the problem completely in 
the sense - vmbus_device_add() should still have been called in this 
scenario IMO. Please see if there is any way to do that, or comment, if 
you feel this issue won't be there.

Regards,
Naman

      reply	other threads:[~2026-03-10 11:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  8:42 [PATCH] Drivers: hv: vmbus: Fix potential NULL pointer dereference in vmbus_acpi_add() Ваторопин Андрей
2026-03-10 11:18 ` 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=8d5360bb-eaf1-4325-acc7-5f3ccdb59dc2@linux.microsoft.com \
    --to=namjain@linux.microsoft.com \
    --cc=a.vatoropin@crpt.ru \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=lvc-project@linuxtesting.org \
    --cc=mikelley@microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=stable@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