From daf5a5a82ca37ccf5b03c103ca44717b0b2f3e0b Mon Sep 17 00:00:00 2001 From: Gautam Menghani Date: Thu, 17 Sep 2026 12:58:38 +0530 Subject: [PATCH] KVM: PPC: Book3S HV: Free the queue pages in error path If the xive_native_configure_queue() call fails, the qpage allocated is not freed, which results in wasted memory. Fix this by freeing the qpage in the error path. Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller") Reviewed-by: Amit Machhiwal Signed-off-by: Gautam Menghani Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20260917072839.78857-1-gautam@linux.ibm.com --- arch/powerpc/kvm/book3s_xive.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c index 1d67237783b7..d348365df72d 100644 --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c @@ -961,9 +961,11 @@ static int xive_provision_queue(struct kvm_vcpu *vcpu, u8 prio) */ rc = xive_native_configure_queue(xc->vp_id, q, prio, qpage, xive->q_order, true); - if (rc) + if (rc) { pr_err("Failed to configure queue %d for VCPU %d\n", prio, xc->server_num); + free_pages((unsigned long)qpage, xive->q_page_order); + } return rc; }