]> Gentwo Git Trees - linux/.git/commit
block: don't leak disk->zones_cond for !disk_need_zone_resources
authorChristoph Hellwig <hch@lst.de>
Wed, 5 Nov 2025 19:52:14 +0000 (14:52 -0500)
committerJens Axboe <axboe@kernel.dk>
Thu, 6 Nov 2025 23:15:27 +0000 (16:15 -0700)
commitc6886cf610f4bb0b8aa6b88ab013a042e317f898
treedd7bff32b6df9153ef24671d83410b73af2ec9fa
parentba13710ddd1f47884701213a3b6a5e470f6bc81e
block: don't leak disk->zones_cond for !disk_need_zone_resources

disk->zones_cond is allocated for all zoned devices, but
disk_free_zone_resources skips it when the zone write plug hash is not
allocated, leaking the allocation for non-mq devices that don't emulate
zone append.  This is reported by kmemleak-enabled xfstests for various
tests that use simple device mapper targets.

Fix this by moving all code that requires writes plugs from
disk_free_zone_resources into disk_destroy_zone_wplugs_hash_table
and executing the rest of the code, including the disk->zones_cond
freeing unconditionally.

Fixes: 6e945ffb6555 ("block: use zone condition to determine conventional zones")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c