diff mbox series

rbd: resurrect setting of disk->private_data in rbd_init_disk()

Message ID 20210721130950.3359-1-idryomov@gmail.com
State New
Headers show
Series rbd: resurrect setting of disk->private_data in rbd_init_disk() | expand

Commit Message

Ilya Dryomov July 21, 2021, 1:09 p.m. UTC
rbd_open() and rbd_release() expect that disk->private_data is set to
rbd_dev.  Otherwise we hit a NULL pointer dereference when mapping the
image.

Fixes: 195b1956b85b ("rbd: use blk_mq_alloc_disk and blk_cleanup_disk")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 drivers/block/rbd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig July 21, 2021, 2:08 p.m. UTC | #1
Oops, sorry. Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 48c485d7efa1..9384395670b2 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4943,6 +4943,7 @@  static int rbd_init_disk(struct rbd_device *rbd_dev)
 		disk->minors = RBD_MINORS_PER_MAJOR;
 	}
 	disk->fops = &rbd_bd_ops;
+	disk->private_data = rbd_dev;
 
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
 	/* QUEUE_FLAG_ADD_RANDOM is off by default for blk-mq */