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 4FA61175A99; Mon, 17 Aug 2026 14:56:33 +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=1786978594; cv=none; b=merMy/z7JMC2o6WvBOe0QDRYLIzed+aCnyQfN9D9uz/TSm4WSE5RpU0kjpBKVPyUTUhxL/eawXx84qLxWxb9+bxKqQOrpwM22vAVAtrVErtwdghFHCjbiTbWciaR7t9eDXICNBCVEuVkNBepil998gNtKFF4Ylof1anvWu3+2iM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786978594; c=relaxed/simple; bh=RH0mNNhy99GScK+x/AZ4FwK/yKz3gHqNw5SI58YJnms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LOVW8og8h9ybX2wqFTZCD4NjM481XxRFyRz2CE4KdLeAm3Bjw31ulMB60cIJsZJ56jfSxTCU+jSXdbDmB9RNerdWTEq1Tt09yrF9zbxAfjmEMEc2zxRNgNtUehvDp9n6qrFaH6Dd8TH+vwc8qr1tkT3u8/5yfKps2FRv6D/IUz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FQLq3jLg; 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="FQLq3jLg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A06FE1F00A3D; Mon, 17 Aug 2026 14:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786978593; bh=hDfDujprUXxq4Uvc0hkdtFL/b7DA8G0z3JzJQQcndK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FQLq3jLgB10sUiR+H+psa3wc3TUo7gS1GK7b1NywG0wtrntlF0l/QjT105XMHv7bP gnq2Q8ajYI5LS1ilJAll37TKJlkN5LWXYlGF1wtHZ6D1g8UHD3i4T9Z/R3GA326D5a VvWOaXoZxZZzAGchof0ngg+JfG0FZyTPtvteTBRE= 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.6 091/156] KVM: s390: pci: Fix missing error codes and memory unaccounting Date: Mon, 17 Aug 2026 15:33:45 +0200 Message-ID: <20260817132538.179983849@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132534.666299318@linuxfoundation.org> References: <20260817132534.666299318@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.6-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 [alifm@linux.ibm.com: Resolve merge conflict] 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 f887e11b0f1ef..a20fa27fa0301 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