mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
@ 2025-04-01 17:32 Nuno Das Neves
  2025-04-02  4:15 ` Michael Kelley
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nuno Das Neves @ 2025-04-01 17:32 UTC (permalink / raw)
  To: linux-hyperv, linux-kernel, wei.liu
  Cc: kys, haiyangz, mhklinux, decui, Nuno Das Neves

'output' is already a pointer to the output argument, it should be
passed directly to hv_do_hypercall() without the '&' operator.

Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
---
This patch is a fixup for:
e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code

 drivers/hv/hv_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
index b3b11be11650..a7d7494feaca 100644
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -307,7 +307,7 @@ void __init hv_get_partition_id(void)
 
 	local_irq_save(flags);
 	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
-	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
+	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output);
 	pt_id = output->partition_id;
 	local_irq_restore(flags);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-01 17:32 [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id Nuno Das Neves
@ 2025-04-02  4:15 ` Michael Kelley
  2025-04-03  8:24 ` Naman Jain
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Kelley @ 2025-04-02  4:15 UTC (permalink / raw)
  To: Nuno Das Neves, linux-hyperv, linux-kernel, wei.liu; +Cc: kys, haiyangz, decui

From: Nuno Das Neves <nunodasneves@linux.microsoft.com> Sent: Tuesday, April 1, 2025 10:32 AM
> 
> 'output' is already a pointer to the output argument, it should be
> passed directly to hv_do_hypercall() without the '&' operator.
> 
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> ---
> This patch is a fixup for:
> e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code
> 
>  drivers/hv/hv_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index b3b11be11650..a7d7494feaca 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -307,7 +307,7 @@ void __init hv_get_partition_id(void)
> 
>  	local_irq_save(flags);
>  	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
> -	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
> +	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output);
>  	pt_id = output->partition_id;
>  	local_irq_restore(flags);
> 
> --
> 2.34.1

I should have caught that when I reviewed the original patch! :-(

Trying again,
Reviewed-by: Michael Kelley <mhklinux@outlook.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-01 17:32 [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id Nuno Das Neves
  2025-04-02  4:15 ` Michael Kelley
@ 2025-04-03  8:24 ` Naman Jain
  2025-04-07  5:24   ` Wei Liu
  2025-04-03 14:02 ` Markus Elfring
  2025-04-07  5:24 ` Wei Liu
  3 siblings, 1 reply; 7+ messages in thread
From: Naman Jain @ 2025-04-03  8:24 UTC (permalink / raw)
  To: Nuno Das Neves, linux-hyperv, linux-kernel, wei.liu
  Cc: kys, haiyangz, mhklinux, decui



On 4/1/2025 11:02 PM, Nuno Das Neves wrote:
> 'output' is already a pointer to the output argument, it should be
> passed directly to hv_do_hypercall() without the '&' operator.
> 
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> ---
> This patch is a fixup for:
> e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code

You can add Fixes: tag, so that it gets ported to previous kernel, in 
case, it does not make it to 6.14.


Regards,
Naman

> 
>   drivers/hv/hv_common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index b3b11be11650..a7d7494feaca 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -307,7 +307,7 @@ void __init hv_get_partition_id(void)
>   
>   	local_irq_save(flags);
>   	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
> -	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
> +	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output);
>   	pt_id = output->partition_id;
>   	local_irq_restore(flags);
>   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-01 17:32 [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id Nuno Das Neves
  2025-04-02  4:15 ` Michael Kelley
  2025-04-03  8:24 ` Naman Jain
@ 2025-04-03 14:02 ` Markus Elfring
  2025-04-07  5:24 ` Wei Liu
  3 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-04-03 14:02 UTC (permalink / raw)
  To: Nuno Das Neves, linux-hyperv
  Cc: LKML, Dexuan Cui, Haiyang Zhang, K. Y. Srinivasan,
	Michael Kelley, Wei Liu

> 'output' is already a pointer to the output argument, it should be
> passed directly to hv_do_hypercall() without the '&' operator.

See also:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14#n94


How do you think about to append parentheses to the function name
in the summary phrase?

Regards,
Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-03  8:24 ` Naman Jain
@ 2025-04-07  5:24   ` Wei Liu
  2025-04-07  5:42     ` Wei Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2025-04-07  5:24 UTC (permalink / raw)
  To: Naman Jain
  Cc: Nuno Das Neves, linux-hyperv, linux-kernel, wei.liu, kys,
	haiyangz, mhklinux, decui

On Thu, Apr 03, 2025 at 01:54:37PM +0530, Naman Jain wrote:
> 
> 
> On 4/1/2025 11:02 PM, Nuno Das Neves wrote:
> > 'output' is already a pointer to the output argument, it should be
> > passed directly to hv_do_hypercall() without the '&' operator.
> > 
> > Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> > ---
> > This patch is a fixup for:
> > e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code
> 
> You can add Fixes: tag, so that it gets ported to previous kernel, in case,
> it does not make it to 6.14.

This does not need to be ported to older kernels because the bug was
never released.

Wei.

> 
> 
> Regards,
> Naman
> 
> > 
> >   drivers/hv/hv_common.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> > index b3b11be11650..a7d7494feaca 100644
> > --- a/drivers/hv/hv_common.c
> > +++ b/drivers/hv/hv_common.c
> > @@ -307,7 +307,7 @@ void __init hv_get_partition_id(void)
> >   	local_irq_save(flags);
> >   	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
> > -	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
> > +	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output);
> >   	pt_id = output->partition_id;
> >   	local_irq_restore(flags);
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-01 17:32 [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id Nuno Das Neves
                   ` (2 preceding siblings ...)
  2025-04-03 14:02 ` Markus Elfring
@ 2025-04-07  5:24 ` Wei Liu
  3 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2025-04-07  5:24 UTC (permalink / raw)
  To: Nuno Das Neves
  Cc: linux-hyperv, linux-kernel, wei.liu, kys, haiyangz, mhklinux, decui

On Tue, Apr 01, 2025 at 10:32:17AM -0700, Nuno Das Neves wrote:
> 'output' is already a pointer to the output argument, it should be
> passed directly to hv_do_hypercall() without the '&' operator.
> 
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>

Applied to hyperv-fixes. Thanks.

> ---
> This patch is a fixup for:
> e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code
> 
>  drivers/hv/hv_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index b3b11be11650..a7d7494feaca 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -307,7 +307,7 @@ void __init hv_get_partition_id(void)
>  
>  	local_irq_save(flags);
>  	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
> -	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
> +	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output);
>  	pt_id = output->partition_id;
>  	local_irq_restore(flags);
>  
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id
  2025-04-07  5:24   ` Wei Liu
@ 2025-04-07  5:42     ` Wei Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2025-04-07  5:42 UTC (permalink / raw)
  To: Naman Jain
  Cc: Nuno Das Neves, linux-hyperv, linux-kernel, wei.liu, kys,
	haiyangz, mhklinux, decui

On Mon, Apr 07, 2025 at 05:24:08AM +0000, Wei Liu wrote:
> On Thu, Apr 03, 2025 at 01:54:37PM +0530, Naman Jain wrote:
> > 
> > 
> > On 4/1/2025 11:02 PM, Nuno Das Neves wrote:
> > > 'output' is already a pointer to the output argument, it should be
> > > passed directly to hv_do_hypercall() without the '&' operator.
> > > 
> > > Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> > > ---
> > > This patch is a fixup for:
> > > e96204e5e96e hyperv: Move hv_current_partition_id to arch-generic code
> > 
> > You can add Fixes: tag, so that it gets ported to previous kernel, in case,
> > it does not make it to 6.14.
> 
> This does not need to be ported to older kernels because the bug was
> never released.

To be clear that was just a passing comment. I'm not against adding a
Fixes tag. I've done that while applying this patch.

Thanks,
Wei.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-07  5:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-01 17:32 [PATCH] Drivers: hv: Fix bad pointer dereference in hv_get_partition_id Nuno Das Neves
2025-04-02  4:15 ` Michael Kelley
2025-04-03  8:24 ` Naman Jain
2025-04-07  5:24   ` Wei Liu
2025-04-07  5:42     ` Wei Liu
2025-04-03 14:02 ` Markus Elfring
2025-04-07  5: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

all inboxes | Powered by JetHome®