Linux-HyperV List
 help / color / mirror / Atom feed
From: Nuno Das Neves <nunodasneves@linux.microsoft.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Anirudh Rayabharam <anrayabh@linux.microsoft.com>,
	Praveen K Paladugu <prapal@linux.microsoft.com>,
	Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference
Date: Fri, 21 Mar 2025 09:53:45 -0700	[thread overview]
Message-ID: <38525f8a-823c-4a79-ac55-68a2ef569a85@linux.microsoft.com> (raw)
In-Reply-To: <9fee7658-1981-48b1-b909-fb2b78894077@stanley.mountain>

On 3/21/2025 7:35 AM, Dan Carpenter wrote:
> Move the NULL check on "partition" before the dereference.
> 
> Fixes: f5288d14069b ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/hv/mshv_synic.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/mshv_synic.c b/drivers/hv/mshv_synic.c
> index a3daedd680ff..88949beb5e37 100644
> --- a/drivers/hv/mshv_synic.c
> +++ b/drivers/hv/mshv_synic.c
> @@ -151,13 +151,12 @@ static bool mshv_async_call_completion_isr(struct hv_message *msg)
>  	rcu_read_lock();
>  
>  	partition = mshv_partition_find(partition_id);
> -	partition->async_hypercall_status = async_msg->status;
> -
>  	if (unlikely(!partition)) {
>  		pr_debug("failed to find partition %llu\n", partition_id);
>  		goto unlock_out;
>  	}
>  
> +	partition->async_hypercall_status = async_msg->status;
>  	complete(&partition->async_hypercall);
>  
>  	handled = true;

Thanks for catching this one!
Wei could you please apply or squash this into the driver patch?

Thanks
Nuno

  reply	other threads:[~2025-03-21 16:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:35 [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference Dan Carpenter
2025-03-21 16:53 ` Nuno Das Neves [this message]
2025-03-21 18:24   ` Wei Liu

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=38525f8a-823c-4a79-ac55-68a2ef569a85@linux.microsoft.com \
    --to=nunodasneves@linux.microsoft.com \
    --cc=anrayabh@linux.microsoft.com \
    --cc=dan.carpenter@linaro.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prapal@linux.microsoft.com \
    --cc=skinsburskii@linux.microsoft.com \
    --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