linux/drivers/block
Christoph Böhmwalder 6d42ddf7f2 drbd: only clone bio if we have a backing device
Commit c347a787e3 (drbd: set ->bi_bdev in drbd_req_new) moved a
bio_set_dev call (which has since been removed) to "earlier", from
drbd_request_prepare to drbd_req_new.

The problem is that this accesses device->ldev->backing_bdev, which is
not NULL-checked at this point. When we don't have an ldev (i.e. when
the DRBD device is diskless), this leads to a null pointer deref.

So, only allocate the private_bio if we actually have a disk. This is
also a small optimization, since we don't clone the bio to only to
immediately free it again in the diskless case.

Fixes: c347a787e3 ("drbd: set ->bi_bdev in drbd_req_new")
Co-developed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Co-developed-by: Joel Colledge <joel.colledge@linbit.com>
Signed-off-by: Joel Colledge <joel.colledge@linbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221020085205.129090-1-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-20 05:45:21 -07:00
..
aoe block: aoe: use DEFINE_SHOW_ATTRIBUTE to simplify aoe_debugfs 2022-09-21 19:49:24 -06:00
drbd drbd: only clone bio if we have a backing device 2022-10-20 05:45:21 -07:00
mtip32xx block: move from strlcpy with unused retval to strscpy 2022-09-21 19:45:04 -06:00
null_blk block: Change the return type of blk_mq_map_queues() into void 2022-08-22 10:07:53 -06:00
paride block: Change the type of req_op() and bio_op() into enum req_op 2022-07-14 12:14:30 -06:00
rnbd v6.1 merge window pull request 2022-10-07 12:05:29 -07:00
xen-blkback xen: branch for v6.0-rc4 2022-09-03 13:23:11 -07:00
zram for-6.1/block-2022-10-03 2022-10-07 09:19:14 -07:00
amiflop.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ataflop.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
brd.c block: move from strlcpy with unused retval to strscpy 2022-09-21 19:45:04 -06:00
floppy.c block/floppy: Fix a sparse warning 2022-07-14 12:14:31 -06:00
Kconfig remove the sx8 block driver 2022-08-02 17:22:46 -06:00
loop.c loop: Check for overflow while configuring loop 2022-08-24 06:52:52 -06:00
Makefile remove the sx8 block driver 2022-08-02 17:22:46 -06:00
n64cart.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
nbd.c Driver core changes for 6.1-rc1 2022-10-07 17:04:10 -07:00
pktcdvd.c block: change the blk_queue_split calling convention 2022-08-02 17:22:53 -06:00
ps3disk.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ps3vram.c block: move from strlcpy with unused retval to strscpy 2022-09-21 19:45:04 -06:00
rbd_types.h
rbd.c We have a good pile of various fixes and cleanups from Xiubo, Jeff, 2022-08-11 12:41:07 -07:00
sunvdc.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
swim3.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
swim_asm.S
swim.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ublk_drv.c ublk_drv: use flexible-array member instead of zero-length array 2022-10-19 18:27:23 -07:00
virtio_blk.c for-6.1/block-2022-10-03 2022-10-07 09:19:14 -07:00
xen-blkfront.c xen: branch for v6.0-rc4 2022-09-03 13:23:11 -07:00
z2ram.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00