From: sashiko-bot@kernel.org
To: "Ibrahim Hashimov" <security@auditcode.ai>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: scsi_debug: fix REPORT ZONES alloc_len underflow OOB write
Date: Thu, 09 Jul 2026 15:18:33 +0000 [thread overview]
Message-ID: <20260709151834.6FF241F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709150631.45018-1-security@auditcode.ai>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Rejecting a REPORT ZONES command with an allocation length smaller than the header size (64 bytes) violates SCSI specifications and breaks legitimate host queries.
--
--- Patch [1]: [PATCH] scsi: scsi_debug: fix REPORT ZONES alloc_len underflow OOB write ---
commit e364d5684dfdc126ea92154dab5b52f73d6c269d
Author: Ibrahim Hashimov <security@auditcode.ai>
scsi: scsi_debug: fix REPORT ZONES alloc_len underflow OOB write
This commit adds a check in resp_report_zones() to reject a report zones
command if the allocation length is smaller than the 64-byte header size.
This is intended to fix an underflow and subsequent out-of-bounds write
when calculating rep_max_zones.
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 9d1c9c41d0f99..2fa887c65b61b 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
[ ... ]
> @@ -5911,6 +5911,11 @@ static int resp_report_zones(struct scsi_cmnd *scp,
> return check_condition_result;
> }
>
> + if (alloc_len < RZONES_DESC_HD) {
> + mk_sense_invalid_fld(scp, SDEB_IN_CDB, 10, -1);
> + return check_condition_result;
> + }
> +
[Severity: Medium]
Does rejecting the command here when alloc_len < RZONES_DESC_HD violate the
SCSI specifications?
The SPC-5 and ZBC standards mandate that allocation length truncation is not
an error. Host applications may probe the zone list length by sending a
report zones command with a small allocation length (between 1 and 63 bytes)
before allocating a full buffer.
Will returning a check condition (invalid field in CDB) break these
legitimate host queries?
> rep_max_zones = (alloc_len - 64) >> ilog2(RZONES_DESC_HD);
>
> arr = kzalloc(alloc_len, GFP_ATOMIC | __GFP_NOWARN);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709150631.45018-1-security@auditcode.ai?part=1
next prev parent reply other threads:[~2026-07-09 15:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 15:06 [PATCH] scsi: scsi_debug: fix REPORT ZONES alloc_len underflow OOB write Ibrahim Hashimov
2026-07-09 15:18 ` sashiko-bot [this message]
2026-07-09 19:48 ` [PATCH v2] " Ibrahim Hashimov
2026-07-10 0:58 ` Damien Le Moal
2026-07-10 5:57 ` [PATCH v3] " Ibrahim Hashimov
2026-07-10 6:03 ` Damien Le Moal
2026-07-10 6:05 ` sashiko-bot
2026-07-10 14:37 ` Bart Van Assche
2026-07-12 18:36 ` Ibrahim Hashimov
2026-07-12 18:37 ` [PATCH v4] " Ibrahim Hashimov
2026-07-13 5:43 ` Damien Le Moal
2026-07-13 17:12 ` Bart Van Assche
2026-07-10 5:59 ` [PATCH v2] " Ibrahim Hashimov
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=20260709151834.6FF241F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=security@auditcode.ai \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.