* [PATCH] KVM: PPC: Fix a memory leak in kvmppc_e500_init()
@ 2026-12-02 9:17 Haoxiang Li
2026-12-05 21:46 ` Thorsten Blum
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-12-02 9:17 UTC (permalink / raw)
To: maddy, npiggin, mpe, chleroy, ritesh.list, sshegde, hollisb, avi,
yu.liu
Cc: kvm, linuxppc-dev, Haoxiang Li
kvmppc_booke_init() allocates pages for the Book E exception
handlers. If the kvm_init() call fails, kvmppc_e500_init()
returns without freeing those pages. Free the pages on this
error path.
Fixes: bc8080cbcc88 ("KVM: ppc: E500 core-specific code")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
arch/powerpc/kvm/e500.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index c58a5a5fb64c..3df53e55765c 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -532,8 +532,11 @@ static int __init kvmppc_e500_init(void)
ivor[max_ivor] + handler_len);
r = kvm_init(sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
- if (r)
+ if (r) {
+ free_pages(kvmppc_booke_handlers, VCPU_SIZE_ORDER);
goto err_out;
+ }
+
kvm_ops_e500.owner = THIS_MODULE;
kvmppc_pr_ops = &kvm_ops_e500;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: PPC: Fix a memory leak in kvmppc_e500_init()
2026-12-02 9:17 [PATCH] KVM: PPC: Fix a memory leak in kvmppc_e500_init() Haoxiang Li
@ 2026-12-05 21:46 ` Thorsten Blum
0 siblings, 0 replies; 2+ messages in thread
From: Thorsten Blum @ 2026-12-05 21:46 UTC (permalink / raw)
To: Haoxiang Li
Cc: maddy, npiggin, mpe, chleroy, ritesh.list, sshegde, hollisb, avi,
yu.liu, kvm, linuxppc-dev
On Wed, Dec 02, 2026 at 05:17:01PM +0800, Haoxiang Li wrote:
> kvmppc_booke_init() allocates pages for the Book E exception
> handlers. If the kvm_init() call fails, kvmppc_e500_init()
> returns without freeing those pages. Free the pages on this
> error path.
>
> Fixes: bc8080cbcc88 ("KVM: ppc: E500 core-specific code")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
Reviewed-by: Thorsten Blum <blum@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 21:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 9:17 [PATCH] KVM: PPC: Fix a memory leak in kvmppc_e500_init() Haoxiang Li
2026-12-05 21:46 ` Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox