]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
block: fix NULL pointer dereference in disk_report_zones()
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 13 Nov 2025 13:40:27 +0000 (22:40 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Nov 2025 16:10:04 +0000 (09:10 -0700)
commit881880b6f3079c79e4306630dcb8d05bc7de1793
treee59471502014bb20e9caff02e2f05bdbeac4c554
parentc2b8d20628ca789640f64074a642f9440eefc623
block: fix NULL pointer dereference in disk_report_zones()

Commit 2284eec5053d ("block: introduce blkdev_get_zone_info()")
introduced the report_active field in struct blk_report_zones_args so
that open and closed zones can be reported with the condition
BLK_ZONE_COND_ACTIVE in the case of a cached report zone.
However, the args pointer to a struct blk_report_zones_args that is
passed to disk_report_zones() can be NULL, e.g. in the case of internal
report zones operations for device mapper zoned targets.

Fix disk_report_zones() to make sure to check that the args is not null
before updating a zone condition for cached zone reports.

Fixes: 2284eec5053d ("block: introduce blkdev_get_zone_info()")
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>
block/blk-zoned.c