* [PATCH] KVM: PPC: Book3S HV: Free nestedv2 state on vCPU creation failure
@ 2026-11-18 10:10 Haoxiang Li
2026-11-18 11:03 ` Ritesh Harjani
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-11-18 10:10 UTC (permalink / raw)
To: maddy, npiggin, mpe, chleroy, ritesh.list, sshegde, jniethe5,
gautam, vaibhav, kconsul
Cc: linuxppc-dev, kvm, linux-kernel, Haoxiang Li
When nestedv2 is enabled, kvmppc_core_vcpu_create_hv() allocates guest
state buffers and messages through kvmhv_nestedv2_vcpu_create(). If
the subsequent vcore lookup or allocation fails, it returns without
releasing those resources.
The caller's error path only calls kvmppc_subarch_vcpu_uninit(), which
does not free the nestedv2 state. Call kvmhv_nestedv2_vcpu_free() before
returning from the vcore error path when nestedv2 is enabled.
Fixes: 19d31c5f1157 ("KVM: PPC: Add support for nestedv2 guests")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
arch/powerpc/kvm/book3s_hv.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 22283d46e8fe..1a1a4e3ba412 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3097,8 +3097,11 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu)
}
}
- if (!vcore)
+ if (!vcore) {
+ if (kvmhv_is_nestedv2())
+ kvmhv_nestedv2_vcpu_free(vcpu, &vcpu->arch.nestedv2_io);
return err;
+ }
spin_lock(&vcore->lock);
++vcore->num_threads;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Free nestedv2 state on vCPU creation failure
2026-11-18 10:10 [PATCH] KVM: PPC: Book3S HV: Free nestedv2 state on vCPU creation failure Haoxiang Li
@ 2026-11-18 11:03 ` Ritesh Harjani
0 siblings, 0 replies; 2+ messages in thread
From: Ritesh Harjani @ 2026-11-18 11:03 UTC (permalink / raw)
To: Haoxiang Li, maddy, npiggin, mpe, chleroy, sshegde, jniethe5,
gautam
Cc: linuxppc-dev, kvm, linux-kernel, Haoxiang Li
Haoxiang Li <haoxiang_li2024@163.com> writes:
> When nestedv2 is enabled, kvmppc_core_vcpu_create_hv() allocates guest
> state buffers and messages through kvmhv_nestedv2_vcpu_create(). If
> the subsequent vcore lookup or allocation fails, it returns without
> releasing those resources.
>
> The caller's error path only calls kvmppc_subarch_vcpu_uninit(), which
> does not free the nestedv2 state. Call kvmhv_nestedv2_vcpu_free() before
> returning from the vcore error path when nestedv2 is enabled.
>
> Fixes: 19d31c5f1157 ("KVM: PPC: Add support for nestedv2 guests")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> arch/powerpc/kvm/book3s_hv.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
The fix for this is already posted here [1]
[1]: https://lore.kernel.org/linuxppc-dev/082c338c69773a73a48cd4e0d0885ee0f6ef5326.1793546707.git.ritesh.list@gmail.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 10:10 [PATCH] KVM: PPC: Book3S HV: Free nestedv2 state on vCPU creation failure Haoxiang Li
2026-11-18 11:03 ` Ritesh Harjani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox