From: sashiko-bot@kernel.org
To: "Stefan Haberland" <sth@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH 3/4] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path
Date: Thu, 12 Nov 2026 10:43:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-210968@kernel.org> (raw)
In-Reply-To: <20261112102608.1057852-4-sth@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] s390/dasd: inaccurate Fixes tag and crash description in commit
message
--
commit b485d08acd9f888238bf37617a7cb2fffa1637cc
Author: Stefan Haberland <sth@linux.ibm.com>
> s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path
>
> 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 <sashiko-bot@kernel.org>
> 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 <hoeppner@linux.ibm.com>
> Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
[Severity: Low]
Are the Fixes tag, the #4.7 stable hint, and the crash description in the
commit message accurate?
Commit 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT") introduced
the missing start_priv->count decrement, but it paired dasd_smalloc_request()
with dasd_sfree_request(). Commit 5e2b17e712cf ("s390/dasd: Add dynamic
formatting support for ESE volumes") in v4.18 introduced
dasd_fmalloc_request() and dasd_ffree_request() and switched
dasd_eckd_build_check_tcw() to dasd_fmalloc_request(), so backporting this
patch to v4.7..v4.17 will fail to build, and this commit should also carry:
Fixes: 5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes")
Also, since commit 9cebfced1324 ("s390/dasd: Add infrastructure for ESE
full-track write"), dasd_sfree_request() checks cqr->mem_chunk and frees
requests with a NULL mem_chunk from device->ese_chunks rather than crashing:
drivers/s390/block/dasd.c:dasd_sfree_request() {
...
if (cqr->mem_chunk)
dasd_free_chunk(&device->ccw_chunks, cqr->mem_chunk);
else
dasd_free_chunk(&device->ese_chunks, cqr);
...
}
So the invalid pointer arithmetic and crash only occur on kernels between
5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes")
and 9cebfced1324 ("s390/dasd: Add infrastructure for ESE full-track write").
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112102608.1057852-1-sth@linux.ibm.com?part=3
next prev parent reply other threads:[~2026-11-12 10:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 10:26 [PATCH 0/4] s390/dasd: fixes for RCD retry and BIODASDCHECKFMT Stefan Haberland
2026-11-12 10:26 ` [PATCH 1/4] s390/dasd: Fix typo 'immediatly' -> 'immediately' Stefan Haberland
2026-11-12 10:30 ` sashiko-bot
2026-11-12 10:26 ` [PATCH 2/4] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Stefan Haberland
2026-11-12 10:32 ` sashiko-bot
2026-11-12 10:26 ` [PATCH 3/4] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Stefan Haberland
2026-11-12 10:43 ` sashiko-bot [this message]
2026-11-12 10:26 ` [PATCH 4/4] s390/dasd: Don't trust userspace-supplied result field in format check Stefan Haberland
2026-11-12 10:34 ` sashiko-bot
2026-11-12 16:18 ` [PATCH 0/4] s390/dasd: fixes for RCD retry and BIODASDCHECKFMT Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-210968@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sth@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox