diff mbox series

[2/2] loop: fix order of cleaning up the queue and freeing the tagset

Message ID 20210616071547.1156283-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev | expand

Commit Message

Christoph Hellwig June 16, 2021, 7:15 a.m. UTC
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@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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);
 }