* [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference
@ 2025-03-21 14:35 Dan Carpenter
2025-03-21 16:53 ` Nuno Das Neves
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-03-21 14:35 UTC (permalink / raw)
To: Nuno Das Neves
Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
Anirudh Rayabharam, Praveen K Paladugu, Stanislav Kinsburskii,
linux-hyperv, linux-kernel, kernel-janitors
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;
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference
2025-03-21 14:35 [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference Dan Carpenter
@ 2025-03-21 16:53 ` Nuno Das Neves
2025-03-21 18:24 ` Wei Liu
0 siblings, 1 reply; 3+ messages in thread
From: Nuno Das Neves @ 2025-03-21 16:53 UTC (permalink / raw)
To: Dan Carpenter, wei.liu@kernel.org
Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
Anirudh Rayabharam, Praveen K Paladugu, Stanislav Kinsburskii,
linux-hyperv, linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference
2025-03-21 16:53 ` Nuno Das Neves
@ 2025-03-21 18:24 ` Wei Liu
0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2025-03-21 18:24 UTC (permalink / raw)
To: Nuno Das Neves
Cc: Dan Carpenter, wei.liu@kernel.org, K. Y. Srinivasan,
Haiyang Zhang, Dexuan Cui, Anirudh Rayabharam, Praveen K Paladugu,
Stanislav Kinsburskii, linux-hyperv, linux-kernel,
kernel-janitors
On Fri, Mar 21, 2025 at 09:53:45AM -0700, Nuno Das Neves wrote:
> 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?
Thank you Dan. I squashed this fix to the original patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-21 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 14:35 [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference Dan Carpenter
2025-03-21 16:53 ` Nuno Das Neves
2025-03-21 18:24 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox