Skip to content

Commit

Permalink
rbd: resurrect setting of disk->private_data in rbd_init_disk()
Browse files Browse the repository at this point in the history
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.

URL: https://tracker.ceph.com/issues/51759
Fixes: 195b195 ("rbd: use blk_mq_alloc_disk and blk_cleanup_disk")
Signed-off-by: Ilya Dryomov <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
  • Loading branch information
idryomov committed Jul 21, 2021
1 parent cdb330f commit 0077a50
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0077a50

Please sign in to comment.