mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
block: check if zone_wplugs_hash exists in queue_zone_wplugs_show
Changhui reported a kernel crash when running this simple shell
reproducer:
# cd /sys/kernel/debug/block && find . -type f -exec grep -aH . {} \;
The above results in a NULL pointer dereference if a device does not have
a zone_wplugs_hash allocated.
To fix this, return early if we don't have a zone_wplugs_hash.
Reported-by: Changhui Zhong <czhong@redhat.com>
Fixes: a98b05b02f
("block: Replace zone_wlock debugfs entry with zone_wplugs entry")
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/e5fec079dfca448cc21c425cfa5d7b291f5faa67.1714046443.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a8f59e5a5d
commit
57787fa42f
@ -1774,6 +1774,9 @@ int queue_zone_wplugs_show(void *data, struct seq_file *m)
|
||||
unsigned int zwp_bio_list_size, i;
|
||||
unsigned long flags;
|
||||
|
||||
if (!disk->zone_wplugs_hash)
|
||||
return 0;
|
||||
|
||||
rcu_read_lock();
|
||||
for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) {
|
||||
hlist_for_each_entry_rcu(zwplug,
|
||||
|
Loading…
Reference in New Issue
Block a user