Skip to content

Commit

Permalink
block: call blk_exit_queue() before freeing q->stats
Browse files Browse the repository at this point in the history
blk_stat_disable_accounting() is added in commit 6849709
("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: 6849709 ("block: make queue stat accounting a reference")
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Ming Lei authored and axboe committed Dec 21, 2021
1 parent a957b61 commit 37e11c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,11 @@ static void blk_release_queue(struct kobject *kobj)
blk_stat_remove_callback(q, q->poll_cb);
blk_stat_free_callback(q->poll_cb);

blk_exit_queue(q);

blk_free_queue_stats(q->stats);
kfree(q->poll_stat);

blk_exit_queue(q);

blk_queue_free_zone_bitmaps(q);

if (queue_is_mq(q))
Expand Down

0 comments on commit 37e11c3

Please sign in to comment.