All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rbd: resurrect setting of disk->private_data in rbd_init_disk()
@ 2021-07-21 13:09 Ilya Dryomov
  2021-07-21 14:08 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Dryomov @ 2021-07-21 13:09 UTC (permalink / raw)
  To: ceph-devel; +Cc: Christoph Hellwig, Chaitanya Kulkarni

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(+)

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 */
-- 
2.19.2


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

end of thread, other threads:[~2021-07-21 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 13:09 [PATCH] rbd: resurrect setting of disk->private_data in rbd_init_disk() Ilya Dryomov
2021-07-21 14:08 ` Christoph Hellwig

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.