]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nbd: fix order of cleaning up the queue and freeing the tagset
authorWang Qing <wangqing@vivo.com>
Tue, 6 Jul 2021 04:00:16 +0000 (12:00 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Jul 2021 15:30:15 +0000 (09:30 -0600)
We must release the queue before freeing the tagset.

Fixes: 4af5f2e03013 ("nbd: use blk_mq_alloc_disk and blk_cleanup_disk")
Reported-and-tested-by: syzbot+9ca43ff47167c0ee3466@syzkaller.appspotmail.com
Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210706040016.1360412-1-guoqing.jiang@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c

index b7d663736d35b3f3796cd4de5859affbb81540c3..c38317979f74ec42a92885d7f963a49526bd8637 100644 (file)
@@ -239,8 +239,8 @@ static void nbd_dev_remove(struct nbd_device *nbd)
 
        if (disk) {
                del_gendisk(disk);
-               blk_mq_free_tag_set(&nbd->tag_set);
                blk_cleanup_disk(disk);
+               blk_mq_free_tag_set(&nbd->tag_set);
        }
 
        /*