]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
block: fix NULL pointer dereference in blk_zone_reset_all_bio_endio()
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 13 Nov 2025 13:40:26 +0000 (22:40 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:17:21 +0000 (10:17 +0100)
commit142dbd7ed190679c7cac335833f313d56e0f1dd2
tree0c136b1f62e0be10899aff355dbb6d985ac4f2e6
parent28a6c420f0e7832a5f2104ef176f9eec7a4e90a1
block: fix NULL pointer dereference in blk_zone_reset_all_bio_endio()

commit c2b8d20628ca789640f64074a642f9440eefc623 upstream.

For zoned block devices that do not need zone write plugs (e.g. most
device mapper devices that support zones), the disk hash table of zone
write plugs is NULL. For such devices, blk_zone_reset_all_bio_endio()
should not attempt to scan this has table as that causes a NULL pointer
dereference.

Fix this by checking that the disk does have zone write plugs using the
atomic counter. This is equivalent to checking for a non-NULL hash table
but has the advantage to also speed up the execution of
blk_zone_reset_all_bio_endio() for devices that do use zone write plugs
but do not have any plug in the hash table (e.g. a disk with only full
zones).

Fixes: efae226c2ef1 ("block: handle zone management operations completions")
Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-zoned.c