[PATCH] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info

[email protected]
Newsgroups gmane.linux.ports.ppc.embedded
Message-ID <[email protected]>
From 80fd05e6d156d5a90d4908f2498bf6cc7acbdefd Mon Sep 17 00:00:00 2001
From: Bui Nguyen Nhu Quynh <[email protected]>
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 <[email protected]>
---
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.