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=1796385455; b=ehAXYQpACc8WmatWOZKg0zFeH/TgbW723XAMFBi29g9dkc0VUuueBZycu5dBuE+Wr0iL xWkCVIMsTnU8QMpZ3js1sbXb5SXe6f8ZKnIk8IjzF/8T62WjYxqlEmfJgknbOmQSzB9IZ BiAMxXNjumUh7uKpvPndS1et9/XLy//mlmFeCd5kvKQ0gJE2cdJMBop4gg7Hv8aFNiEU3 6S11Fx2ApRTl5l+ZbMfUcBC4raZMrbwKhd/at7w5lVZSXmM5I0vWfRn4NuX/q28QtoP/E ImEI/XoNhKKRLQVvOgJJ1OQv1QRZZb3zLTHzIfjpdi2A+iB0ykkHycg7u12UCOtpWEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385455; 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-Type:Content-Transfer-Encoding; bh=wTt/FARd4Jd4QRENbX/+nkWXsMLg6ClG0u8Kp1nCFWQ=; b=vXBhIFzeIXXuzZx56sgMShDswzzp1x9d448FmOngl5kAr+OKpu/D8/yAK86J3x+F1rxL lO4crgqQW1lQ/Zgx3bTnq+OUKtrl6e+4jgJuELqOOVF1tusP7R+kNyeD2uURns9bBaO+v g5TP4piTiW6X51y8EUKEyjnOi7xw6KJl8ernnFqfcPQRXn6thafOT6lRvQb47TfxnUmOj 1IwL/XvRuXq/9D0/1kbEFYyaZDO9aotED0Ltv9WhGqYNR3tGAMunEAVphVH/gIQYpTvPF F5hrDcYsW//ylpCKiAWkYwjD2A96mUZEBqoplcdTCIMxedTfw+s0RRKG60GO5vT8xZQ== 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=xukaBVY3; 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 12DB1606A322; Fri, 4 Dec 2026 11:57:35 +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=xukaBVY3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 535711F00935; Fri, 4 Dec 2026 11:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385454; bh=wTt/FARd4Jd4QRENbX/+nkWXsMLg6ClG0u8Kp1nCFWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xukaBVY3Re1l+9Fp7dTDL8UaoTparExXfdao4PbfeTlMDRC3gLu8ztQDZDdyKXTIn 0LF7eASrW0bnNOFwFnApS4Jd/B6JMOtmLPVYFtDs2+mQk92ZP+9uCCzkAlOr0njzb2 q5J+RuY7EU9XLGA+6P+33vYoguHfHxumHnc+mkmU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , =?UTF-8?q?Jan=20H=C3=B6ppner?= , Stefan Haberland , Jens Axboe Subject: [PATCH 6.6 0563/1167] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Date: Fri, 4 Dec 2026 18:59:50 +0900 Message-ID: <20261204100716.713079804@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Haberland commit df56f7a6c20a5eb2794c0a7391bde50ba7c8c54b upstream. dasd_eckd_build_check_tcw() allocates its request with dasd_fmalloc_request(), but its out_err path frees it with dasd_sfree_request(). The latter uses a different pool and therefor, leading to invalid pointer arithmetic and a crash. Use the matching dasd_ffree_request() instead. The same error path also leaves start_priv->count incremented without ever decrementing it again. This leaks a permanent reference on every build failure. Decrement it before freeing the request. Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260722103704.1709668-1-sth@linux.ibm.com Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT") Cc: stable@vger.kernel.org #4.7 Reviewed-by: Jan Höppner Signed-off-by: Stefan Haberland Fixes: 5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes") Link: https://patch.msgid.link/20261112102608.1057852-4-sth@linux.ibm.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd_eckd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -2607,7 +2607,8 @@ dasd_eckd_build_check_tcw(struct dasd_de return cqr; out_err: - dasd_sfree_request(cqr, startdev); + start_priv->count--; + dasd_ffree_request(cqr, startdev); return ERR_PTR(rc); }