nbd: fix nbd device deletion
authorJosef Bacik <jbacik@fb.com>
Wed, 16 May 2018 18:51:17 +0000 (14:51 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jun 2018 00:06:31 +0000 (08:06 +0800)
commitedee2e826640c1ba54d51914b1699bc24a1f32c9
treea5651f9c2b29fa53911a45139aa9707d64e88862
parentffb179cfbcf66da752524983a702e8adbaf462b7
nbd: fix nbd device deletion

commit 8364da4751cf22201d74933d5e634176f44ed407 upstream.

This fixes a use after free bug, we shouldn't be doing disk->queue right
after we do del_gendisk(disk).  Save the queue and do the cleanup after
the del_gendisk.

Fixes: c6a4759ea0c9 ("nbd: add device refcounting")
cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c