All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nbd: del_gendisk after we cleanup the queue
@ 2018-04-13 16:03 Josef Bacik
  2018-04-13 16:03 ` [PATCH 2/3] nbd: update size when connected Josef Bacik
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Josef Bacik @ 2018-04-13 16:03 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team, alex; +Cc: Josef Bacik, stable

From: Josef Bacik <jbacik@fb.com>

This fixes a use after free bug, we need to do the del_gendisk after we
cleanup the queue on the device.

Fixes: c6a4759ea0c9 ("nbd: add device refcounting")
cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 86258b00a1d4..e33da3e6aa20 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -174,8 +174,8 @@ static void nbd_dev_remove(struct nbd_device *nbd)
 {
 	struct gendisk *disk = nbd->disk;
 	if (disk) {
-		del_gendisk(disk);
 		blk_cleanup_queue(disk->queue);
+		del_gendisk(disk);
 		blk_mq_free_tag_set(&nbd->tag_set);
 		disk->private_data = NULL;
 		put_disk(disk);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-04-14  3:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 16:03 [PATCH 1/3] nbd: del_gendisk after we cleanup the queue Josef Bacik
2018-04-13 16:03 ` [PATCH 2/3] nbd: update size when connected Josef Bacik
2018-04-14  3:02   ` Alex Gorbachev
2018-04-13 16:03 ` [PATCH 3/3] nbd: use bd_set_size when updating disk size Josef Bacik
2018-04-14  3:01   ` Alex Gorbachev
2018-04-13 16:16 ` [PATCH 1/3] nbd: del_gendisk after we cleanup the queue Bart Van Assche
2018-04-13 16:16   ` Bart Van Assche
2018-04-13 16:21   ` Josef Bacik
2018-04-13 16:25     ` Bart Van Assche
2018-04-13 16:25       ` Bart Van Assche
2018-04-14  3:03 ` Alex Gorbachev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.