From: Damien Le Moal <dlemoal@kernel.org>
To: "Martin K. Petersen (Oracle)" <mkp@kernel.org>,
Jens Axboe <axboe@kernel.dk>, ZHOU Jiaxiang <me@fxti.xyz>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v4 1/2] block: fix zones_cond out-of-bounds write on zone report
Date: Thu, 17 Sep 2026 09:50:55 +0700 [thread overview]
Message-ID: <126ddf3d-a27f-4c46-a4db-a93c3145363d@kernel.org> (raw)
In-Reply-To: <178961190604.3672510.18119102289310587808.b4-ty@b4>
On 2026/09/17 9:28, Martin K. Petersen (Oracle) wrote:
> On Wed, 16 Sep 2026 21:58:21 +0800, ZHOU Jiaxiang wrote:
>
>> blk_revalidate_disk_zones() sizes the zones_cond array from the disk
>> capacity and zone size, but the index used by blk_revalidate_zone_cond()
>> comes from the device-driven report_zones() walk and is never checked
>> against the array size. A device reporting more zones than fit the
>> array makes blk_zone_set_cond() write out of bounds.
>>
>> One way to reach this is a zone count exceeding 32 bits: both
>> blk_revalidate_zone_args.nr_zones and struct zoned_disk_info.nr_zones
>> are unsigned int, so a disk advertising more than UINT_MAX zones (e.g.
>> 2^32 + 1024 zones of one 512-byte logical block) gets its zone count
>> truncated to a small value, undersizing the array while the report
>> walk keeps counting upward.
>>
>> [...]
>
> Applied to 7.3/scsi-fixes, thanks!
>
> [1/2] block: fix zones_cond out-of-bounds write on zone report
> https://git.kernel.org/mkp/scsi/c/7c431d61b69a
> [2/2] scsi: sd_zbc: reject disks with too many zones
> https://git.kernel.org/mkp/scsi/c/b6ec0f797459
>
I just asked about this :)
We will have a conflict in Linux-next with this unless Jens does a rebase of
block/for-next.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-09-17 2:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260916135822.32584-1-me@fxti.xyz>
2026-09-16 13:58 ` [PATCH v4 1/2] block: fix zones_cond out-of-bounds write on zone report ZHOU Jiaxiang
2026-09-17 2:28 ` Martin K. Petersen (Oracle)
2026-09-17 2:50 ` Damien Le Moal [this message]
2026-09-17 2:49 ` Damien Le Moal
2026-09-16 13:58 ` [PATCH v4 2/2] scsi: sd_zbc: reject disks with too many zones ZHOU Jiaxiang
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=126ddf3d-a27f-4c46-a4db-a93c3145363d@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=me@fxti.xyz \
--cc=mkp@kernel.org \
/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