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 C78A837DE9B; Thu, 20 Aug 2026 17:43:54 +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=1787247835; cv=none; b=OAvxzeRDlekeyrmDZWzKzUYFtGGwF0NdjyqOsxr4XcMRL1pvVc/syZqOpiLsYie3dwMAx5aJ05QsuvTBogKqpp2P7O1prCcUCG37dkc5r0lbIb03h8itDOkNRebQ8XXk+B1gBhO1AMhVEokR4LsMQfHp/Ojf2rraTUdxfynrYIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247835; c=relaxed/simple; bh=iORBYttrjtWZzbLd0IneLbSjD2ytZkQ7LDL+FJAapH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mNC99ra3p0PaUL0ezVIj36YBWlYfOwhWPYKFH27YQedk6WxYoCJicx+5+0vxoRpu47cqmwQqSm+r1m/Njx7QLb/WUVhuqLyZb4bFx7w+jAtBmgnBvzsqKlGdc2khEgecojPT3+CX7PAdg4p0H33nb9V8Vbt6zEoTVC6F8Am0D7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ffwZGlAg; 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="ffwZGlAg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E0471F000E9; Thu, 20 Aug 2026 17:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787247834; bh=MnHaOI2Dbkj26yERCTUAtDpvvU6hThoCt03QxNhWf60=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ffwZGlAgzvmbmweZiWqfj5ctehICagcI/4RSoaqob4joroENrP7cg5xdNL9Yqe4jW knNM1BTRS4uzSLd7gPvOmScFw1ton0F/VrHz8zXdkT/IGcvMFQBZXaqgnvYHNo2nTO JcsrUzn7BqorhhZb42007bjOM1FFZ2v3zsmbQ7SM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Borntraeger , Matthew Rosato , Farhan Ali , Sasha Levin Subject: [PATCH 6.1 004/303] KVM: s390: pci: Fix missing error codes and memory unaccounting Date: Thu, 20 Aug 2026 16:52:20 +0200 Message-ID: <20260820145253.329581961@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145253.200766705@linuxfoundation.org> References: <20260820145253.200766705@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: Farhan Ali [ Upstream commit f86842e4d6c482300f4567f492d512c9ccf5bc4f ] In kvm_s390_pci_aif_enable() two error paths failed to set an error code, causing the function to return 0 on failure. It also failed to rollback memory accounting on failure. Fix both by propagating an error code on failure and calling unaccount_mem() in the cleanup path. Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding") Cc: stable@vger.kernel.org Reviewed-by: Christian Borntraeger Reviewed-by: Matthew Rosato Signed-off-by: Farhan Ali Tested-by: Matthew Rosato Signed-off-by: Christian Borntraeger Signed-off-by: Farhan Ali Signed-off-by: Sasha Levin --- arch/s390/kvm/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c index 4b1ed363b1ef..a6f6d5ddb0e3 100644 --- a/arch/s390/kvm/pci.c +++ b/arch/s390/kvm/pci.c @@ -315,14 +315,17 @@ static int kvm_s390_pci_aif_enable(struct zpci_dev *zdev, struct zpci_fib *fib, } /* Account for pinned pages, roll back on failure */ - if (account_mem(zdev->kzdev, pcount)) + rc = account_mem(zdev->kzdev, pcount); + if (rc) goto unpin2; /* AISB must be allocated before we can fill in GAITE */ mutex_lock(&aift->aift_lock); bit = airq_iv_alloc_bit(aift->sbv); - if (bit == -1UL) + if (bit == -1UL) { + rc = -ENOMEM; goto unlock; + } zdev->aisb = bit; /* store the summary bit number */ zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK | @@ -374,6 +377,8 @@ static int kvm_s390_pci_aif_enable(struct zpci_dev *zdev, struct zpci_fib *fib, airq_iv_free_bit(aift->sbv, zdev->aisb); zdev->aisb = 0; unlock: + if (pcount > 0) + unaccount_mem(zdev->kzdev, pcount); mutex_unlock(&aift->aift_lock); unpin2: if (fib->fmt0.sum == 1) -- 2.53.0