We must release the queue before freeing the tagset. Fixes: 1c99502fae35 ("loop: use blk_mq_alloc_disk and blk_cleanup_disk") Reported-by: Bruno Goncalves <bgoncalv@xxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 9a48b3f9a15c..e0c4de392eab 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2172,8 +2172,8 @@ static int loop_add(struct loop_device **l, int i) static void loop_remove(struct loop_device *lo) { del_gendisk(lo->lo_disk); - blk_mq_free_tag_set(&lo->tag_set); blk_cleanup_disk(lo->lo_disk); + blk_mq_free_tag_set(&lo->tag_set); mutex_destroy(&lo->lo_mutex); kfree(lo); } -- 2.30.2