block: call blk_exit_queue() before freeing q->stats
authorMing Lei <ming.lei@redhat.com>
Tue, 21 Dec 2021 04:04:36 +0000 (12:04 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Dec 2021 04:07:51 +0000 (21:07 -0700)
commit37e11c3616f6182b6bd7f95a04df035b43464f39
tree1c967b8b2be29949e82c5105055fc7827cb370b2
parenta957b61254a7d59a6c14ee2ac2db20a62eb299a1
block: call blk_exit_queue() before freeing q->stats

blk_stat_disable_accounting() is added in commit 68497092bde9
("block: make queue stat accounting a reference"), and called in
kyber_exit_sched().

So we have to free q->stats after elevator is unloaded from
blk_exit_queue() in blk_release_queue(). Otherwise kernel panic
is caused.

Fixes: 68497092bde9 ("block: make queue stat accounting a reference")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20211221040436.1333880-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c