All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
@ 2026-09-01 13:26 nhuquynh
  2026-09-07  8:33 ` Gautam Menghani
  2026-09-07  9:27 ` Amit Machhiwal
  0 siblings, 2 replies; 3+ messages in thread
From: nhuquynh @ 2026-09-01 13:26 UTC (permalink / raw)
  To: Maddy; +Cc: Npiggin, Mpe, Chleroy, Linuxppc Dev, Kvm, Linux Kernel

From 80fd05e6d156d5a90d4908f2498bf6cc7acbdefd Mon Sep 17 00:00:00 2001
From: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
Date: Tue, 1 Sep 2026 19:39:49 +0700
Subject: [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info

The kvmppc_gsm_refresh_info() function incorrectly checks for the
presence of the fill_info callback instead of refresh_info.

This can lead to:
- NULL pointer dereference if refresh_info is NULL but fill_info is present
- EINVAL return if refresh_info is present but fill_info is NULL

Fix this by checking the correct callback.

Fixes: 6ccbbc33f06ad ("KVM: PPC: Add helper library for Guest State Buffers")
Signed-off-by: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
---
arch/powerpc/kvm/guest-state-buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/guest-state-buffer.c b/arch/powerpc/kvm/guest-state-buffer.c
index 42843eca6727..aeb586ba4523 100644
--- a/arch/powerpc/kvm/guest-state-buffer.c
+++ b/arch/powerpc/kvm/guest-state-buffer.c
@@ -598,7 +598,7 @@ EXPORT_SYMBOL_GPL(kvmppc_gsm_fill_info);
int kvmppc_gsm_refresh_info(struct kvmppc_gs_msg *gsm,
    struct kvmppc_gs_buff *gsb)
{
-	if (!gsm->ops->fill_info)
+	if (!gsm->ops->refresh_info)
return -EINVAL;
 
return gsm->ops->refresh_info(gsm, gsb);
-- 
2.54.0

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

* Re: [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
  2026-09-01 13:26 [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info nhuquynh
@ 2026-09-07  8:33 ` Gautam Menghani
  2026-09-07  9:27 ` Amit Machhiwal
  1 sibling, 0 replies; 3+ messages in thread
From: Gautam Menghani @ 2026-09-07  8:33 UTC (permalink / raw)
  To: nhuquynh; +Cc: Maddy, Npiggin, Mpe, Chleroy, Linuxppc Dev, Kvm, Linux Kernel

On Tue, Sep 01, 2026 at 03:26:56PM +0200, nhuquynh@tutamail.com wrote:
> From 80fd05e6d156d5a90d4908f2498bf6cc7acbdefd Mon Sep 17 00:00:00 2001
> From: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
> Date: Tue, 1 Sep 2026 19:39:49 +0700
> Subject: [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
> 

This should not be in the patch description.

> The kvmppc_gsm_refresh_info() function incorrectly checks for the
> presence of the fill_info callback instead of refresh_info.
> 
> This can lead to:
> - NULL pointer dereference if refresh_info is NULL but fill_info is present
> - EINVAL return if refresh_info is present but fill_info is NULL
> 
> Fix this by checking the correct callback.
> 
> Fixes: 6ccbbc33f06ad ("KVM: PPC: Add helper library for Guest State Buffers")
> Signed-off-by: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
> ---
> arch/powerpc/kvm/guest-state-buffer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/guest-state-buffer.c b/arch/powerpc/kvm/guest-state-buffer.c
> index 42843eca6727..aeb586ba4523 100644
> --- a/arch/powerpc/kvm/guest-state-buffer.c
> +++ b/arch/powerpc/kvm/guest-state-buffer.c
> @@ -598,7 +598,7 @@ EXPORT_SYMBOL_GPL(kvmppc_gsm_fill_info);
> int kvmppc_gsm_refresh_info(struct kvmppc_gs_msg *gsm,
>     struct kvmppc_gs_buff *gsb)
> {
> -	if (!gsm->ops->fill_info)
> +	if (!gsm->ops->refresh_info)
> return -EINVAL;
>  
> return gsm->ops->refresh_info(gsm, gsb);
> -- 
> 2.54.0


This patch does not apply

# git apply 20260901_nhuquynh_kvm_ppc_fix_callback_check_in_kvmppc_gsm_refresh_info.mbx --check --verbose
error: corrupt patch at 20260901_nhuquynh_kvm_ppc_fix_callback_check_in_kvmppc_gsm_refresh_info.mbx:30


The change itself is fine, but please fix the above issues and send a
v2. Refer the documentation in case something is not clear -
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Thanks,
Gautam


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

* Re: [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
  2026-09-01 13:26 [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info nhuquynh
  2026-09-07  8:33 ` Gautam Menghani
@ 2026-09-07  9:27 ` Amit Machhiwal
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Machhiwal @ 2026-09-07  9:27 UTC (permalink / raw)
  To: nhuquynh; +Cc: Maddy, Npiggin, Mpe, Chleroy, Linuxppc Dev, Kvm, Linux Kernel

On 2026/09/01 03:26 PM, nhuquynh@tutamail.com wrote:
> From 80fd05e6d156d5a90d4908f2498bf6cc7acbdefd Mon Sep 17 00:00:00 2001
> From: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
> Date: Tue, 1 Sep 2026 19:39:49 +0700
> Subject: [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
> 
> The kvmppc_gsm_refresh_info() function incorrectly checks for the
> presence of the fill_info callback instead of refresh_info.
> 
> This can lead to:
> - NULL pointer dereference if refresh_info is NULL but fill_info is present
> - EINVAL return if refresh_info is present but fill_info is NULL
> 
> Fix this by checking the correct callback.
> 
> Fixes: 6ccbbc33f06ad ("KVM: PPC: Add helper library for Guest State Buffers")
> Signed-off-by: Bui Nguyen Nhu Quynh <nhuquynh@tutamail.com>
> ---
> arch/powerpc/kvm/guest-state-buffer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/guest-state-buffer.c b/arch/powerpc/kvm/guest-state-buffer.c
> index 42843eca6727..aeb586ba4523 100644
> --- a/arch/powerpc/kvm/guest-state-buffer.c
> +++ b/arch/powerpc/kvm/guest-state-buffer.c
> @@ -598,7 +598,7 @@ EXPORT_SYMBOL_GPL(kvmppc_gsm_fill_info);
> int kvmppc_gsm_refresh_info(struct kvmppc_gs_msg *gsm,
>     struct kvmppc_gs_buff *gsb)
> {
> -	if (!gsm->ops->fill_info)
> +	if (!gsm->ops->refresh_info)
> return -EINVAL;

Thanks for catching this.

The patch appears corrupted by your email client (whitespace mangling /
quoted-printable encoding).

❯ git apply ./20260901_nhuquynh_kvm_ppc_fix_callback_check_in_kvmppc_gsm_refresh_info.mbx
error: corrupt patch at line 30

Please consider configuring and using git send-email to submit v2.

Thanks,
Amit

>  
> return gsm->ops->refresh_info(gsm, gsb);
> -- 
> 2.54.0


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

end of thread, other threads:[~2026-09-07  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 13:26 [PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info nhuquynh
2026-09-07  8:33 ` Gautam Menghani
2026-09-07  9:27 ` Amit Machhiwal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.