From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384003; b=hiu5sz5zQqIrau+2x46cV8+GX62UczF/0yGFQ24pffsrRQl87kj4AsoDDLOOUxDz7LEs fl2kT/YYVY1ZkIvC6VZuDtxK4dhmbtp02JOnPaQcHIkm07HGZpFRkcxnAM2Xy7vSWRo8U oBJMYNbZux59c04zHdTJcCVXdIG9pA3N92KiVkjo3em6uEEpuJMGNUHOKlM7LYyzoFl4z LkvAN6eKEbCDuK76SXNwFNiSiLxv9Uq8RSH11C1dbbfz2pqXGTsSE5c9LZYQDRQ+IZofD V5g7dOXu85+SklMM1hal7H1B5hngd2xw0kwPqOkS4SB+/PdDYwMq4/St9enSwGNT6IA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384003; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Ak2zcAcK/21H38sP/57pQDB3gA+XedYfsM3kpnOoN8A=; b=RFhLZWNRQtS3aCF/3AtK+GlJc5x4ekQfZUQy0gN08d8lOkakSUhxpgOTobZ4EYf9EOco DcbgJnrTLXgs3H4I3+Zt5XwhlbMHICGP/Ot4nQO8qfUf3aWaHDyn5wijFsp9XNaVX2fDn RYfQhH0nUD2fxB2b3vV8qdzJ2zdY8LJtNNdF5l5Wq2QetoAXzOR2BmfN8FcF0NKpexxP9 86aSXVkyXAI2/5D/TGQj5qzPSGRt2/FgCnMPCAG+MT5PDZBzBFHXlaAyh72Cy21IoiNXu +muk2uNWKJlaaPVvuSsnFbd0US7L3hcpRDZmBj4gbcpQFwiE/EPJpi19GBOsCWaR/qQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mPB0VsED; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16384606A322; Fri, 4 Dec 2026 11:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mPB0VsED Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A1DB1F000CE; Fri, 4 Dec 2026 11:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384002; bh=Ak2zcAcK/21H38sP/57pQDB3gA+XedYfsM3kpnOoN8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mPB0VsEDz4t1Wg3u+R4MM1Jc4lOY2TfsfWZ3KS5mx/Cka2dE8DXNLP+DqULWctS10 VfbkW8A08y5XOR1PPvHZcfy5wn7sJv6G+5bJKWpK4LFiUy2g1lvQA050yjRdWVR01H DnyJBsAdtOkSBnR52EeqXN0MHTWLku1eP/0behqw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gautam Menghani , "Ritesh Harjani (IBM)" , Madhavan Srinivasan Subject: [PATCH 6.12 417/555] KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu() Date: Fri, 4 Dec 2026 19:07:40 +0900 Message-ID: <20261204100625.605023318@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gautam Menghani commit 7279692d70f3e399b3dd2d07ffa365e9f533761f upstream. In kvmppc_xive_connect_vcpu() if there is a failure before xc->vp_ipi_data is setup, it can result in a NULL pointer dereference in kvmppc_xive_cleanup_vcpu() when accessing the MMIO page in xive_vm_esb_load(). Fix this by adding a check before masking the VP IPI before accessing the MMIO pages. Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller") Cc: stable@vger.kernel.org # 4.12+ Signed-off-by: Gautam Menghani Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20261012082922.218799-4-gautam@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_xive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c @@ -1820,7 +1820,8 @@ void kvmppc_xive_cleanup_vcpu(struct kvm kvmppc_xive_disable_vcpu_interrupts(vcpu); /* Mask the VP IPI */ - xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01); + if (xc->vp_ipi_data.eoi_mmio) + xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01); /* Free escalations */ for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {