From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 1/7] block: fail reads to offline zones early
Date: Wed, 07 Oct 2026 08:41:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-162755@kernel.org> (raw)
In-Reply-To: <20261007082344.1049179-2-dlemoal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] block: slab-out-of-bounds read in disk_zone_get_state() due to race with capacity expansion
--
commit 891363eb78b3eced11718bdb36c5d62832506870
Author: Damien Le Moal <dlemoal@kernel.org>
block: fail reads to offline zones early
Any BIO targeting an offline zone of a zoned block device will fail,
including read commands. This commit fails these read operations early if we
ever see one.
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 8836c7028568b..5c6be90e5d7f6 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -867,6 +867,9 @@ void submit_bio_noacct(struct bio *bio)
>
> switch (bio_op(bio)) {
> case REQ_OP_READ:
> + if (bdev_is_zoned(bdev) &&
> + bdev_zone_is_offline(bdev, bio->bi_iter.bi_sector))
[Severity: High]
Could this introduce a data race leading to a slab-out-of-bounds read?
Looking at the fast path in submit_bio_noacct(), this evaluates
bdev_zone_is_offline() locklessly before blk_queue_enter() is called to
freeze the queue.
Concurrently, disk_revalidate_zone_resources() can expand the zone capacity
and update disk->nr_zones before replacing the RCU-protected zones_state
array:
block/blk-zoned.c:disk_revalidate_zone_resources() {
...
disk->nr_zones = args->nr_zones;
...
disk_set_zones_state_array(disk, args->zones_state);
}
Because disk->nr_zones is updated independently of the disk->zones_state
array replacement, a reader in disk_zone_get_state() might fetch the new,
larger nr_zones value but still dereference the old, smaller zones_state
array pointer.
If a read bio targets a sector in the newly expanded region, the bounds
check in disk_zone_get_state() would pass incorrectly:
block/blk-zoned.c:disk_zone_get_state() {
...
zones_state = rcu_dereference(disk->zones_state);
if (likely(zones_state && zno < disk->nr_zones))
zs = zones_state[zno];
...
}
This would lead to an out-of-bounds read on the old array allocation. Should
we ensure the queue is entered or otherwise protect against concurrent zone
revalidation before checking the offline status?
> + goto end_io;
> break;
> case REQ_OP_WRITE:
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007082344.1049179-1-dlemoal@kernel.org?part=1
next prev parent reply other threads:[~2026-10-07 8:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 8:23 [PATCH v3 0/7] Add support for storage element depopulation Damien Le Moal
2026-10-07 8:23 ` [PATCH v3 1/7] block: fail reads to offline zones early Damien Le Moal
2026-10-07 8:41 ` sashiko-bot [this message]
2026-10-07 13:29 ` Christoph Hellwig
2026-10-07 14:31 ` Damien Le Moal
2026-10-07 8:23 ` [PATCH v3 2/7] block: introduce storage element management Damien Le Moal
2026-10-07 8:34 ` sashiko-bot
2026-10-07 13:35 ` Christoph Hellwig
2026-10-07 14:35 ` Damien Le Moal
2026-10-07 8:23 ` [PATCH v3 3/7] block: add storage element management ioctls Damien Le Moal
2026-10-07 8:39 ` sashiko-bot
2026-10-07 13:39 ` Christoph Hellwig
2026-10-07 14:37 ` Damien Le Moal
2026-10-07 15:28 ` Christoph Hellwig
2026-10-07 8:23 ` [PATCH v3 4/7] zloop: add storage element emulation Damien Le Moal
2026-10-07 8:35 ` sashiko-bot
2026-10-07 13:40 ` Christoph Hellwig
2026-10-07 8:23 ` [PATCH v3 5/7] zloop: add degrade_element control command Damien Le Moal
2026-10-07 8:39 ` sashiko-bot
2026-10-07 8:23 ` [PATCH v3 6/7] scsi: sd_zbc: always revalidate zones for disks supporting head depopulation Damien Le Moal
2026-10-07 8:35 ` sashiko-bot
2026-10-07 8:23 ` [PATCH v3 7/7] scsi: sd_zbc: define storage element management operations Damien Le Moal
2026-10-07 8:40 ` sashiko-bot
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-162755@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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