From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 630D64F68C3; Wed, 30 Sep 2026 16:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790785505; cv=none; b=KbsYxEHPjuJAI4XJlpaukICuUn3ZpVZCw5ro08ipneE0yhr1417V7v2UNYUzBkUPjpG3cVtU0trWoIwRPQjpQZsyW0DMc9AZ2kR3B6g4H/ie9eyhwlH7CItIRCyXtL0Su3hn2f85ZrItDaXDmvNRcdMVq6yQm1rjwHt0QO+75Qw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790785505; c=relaxed/simple; bh=qqZIDCJurCw0Gbq3GWimJ79l2sVr1BrS32XUMS9Flrg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DphJmcH4e9NQ9IGp7keDYBQgb59ol7PK30QAGLBxsDTIzG7A8JO7kdSArE3lVc4z1seNRDRYoYT/K3JKBEqLOcRa836ozvZENQI/P1SVF+meqNfRyvBRC0QOCLo3hGXnD02iU+33wDhxrz+MzV1Pc5x/F/dpy7u2fG/Y2WYjnas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FNnDwO9u; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FNnDwO9u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A8931F000FF; Wed, 30 Sep 2026 16:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790785494; bh=V5vMYTSqkx2nDsIg6+TOHjS44FDyDiQ6+zi69wjOT98=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FNnDwO9uDSWGIIW7VEZgC3DP+y1Z8N+SEdDc0oPIQgRkUipxE5GVjNa47oVInYowY uCbc2ietBv2lq1mmCUqa/zE/HfjnmwqN0lQ2lKNvLBgy6KUsPp/fUc7oXKquHve9VE fK5zEv6HhvqlXgRIETdDpwMzNV0AUFktEtnTC+1E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sean Christopherson , leixiang , Amit Machhiwal , Vaibhav Jain , Madhavan Srinivasan Subject: [PATCH 6.1 528/982] KVM: PPC: Book3S HV: Set irqfd->producer only on success Date: Wed, 30 Sep 2026 17:21:04 +0200 Message-ID: <20260930152428.114084257@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: leixiang commit 1144454ea22290d7c6998a2af6239e5995476afc upstream. Set irqfd->producer only after kvmppc_set_passthru_irq() succeeds to avoid leaving a dangling pointer on failure. The bypass manager does not register a failed producer, so the pointer is never cleared. Fixes: c57875f5f9be ("KVM: PPC: Book3S HV: Enable IRQ bypass") Suggested-by: Sean Christopherson Cc: stable@vger.kernel.org Signed-off-by: leixiang Reviewed-by: Amit Machhiwal Reviewed-by: Vaibhav Jain Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20260709055755.31297-1-leixiang@kylinos.cn Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -5756,12 +5756,12 @@ static int kvmppc_irq_bypass_add_produce struct kvm_kernel_irqfd *irqfd = container_of(cons, struct kvm_kernel_irqfd, consumer); - irqfd->producer = prod; - ret = kvmppc_set_passthru_irq(irqfd->kvm, prod->irq, irqfd->gsi); if (ret) pr_info("kvmppc_set_passthru_irq (irq %d, gsi %d) fails: %d\n", prod->irq, irqfd->gsi, ret); + else + irqfd->producer = prod; return ret; }