linux/drivers/block
Liu Xiaodong ee1e3fe4b4 block: ublk: extending queue_size to fix overflow
[ Upstream commit 29baef789c ]

When validating drafted SPDK ublk target, in a case that
assigning large queue depth to multiqueue ublk device,
ublk target would run into a weird incorrect state. During
rounds of review and debug, An overflow bug was found
in ublk driver.

In ublk_cmd.h, UBLK_MAX_QUEUE_DEPTH is 4096 which means
each ublk queue depth can be set as large as 4096. But
when setting qd for a ublk device,
sizeof(struct ublk_queue) + depth * sizeof(struct ublk_io)
will be larger than 65535 if qd is larger than 2728.
Then queue_size is overflowed, and ublk_get_queue()
references a wrong pointer position. The wrong content of
ublk_queue elements will lead to out-of-bounds memory
access.

Extend queue_size in ublk_device as "unsigned int".

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Fixes: 71f28f3136 ("ublk_drv: add io_uring based userspace block driver")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230131070552.115067-1-xiaodong.liu@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-09 11:28:08 +01:00
..
aoe
drbd use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
mtip32xx
null_blk
paride
rnbd block/rnbd-clt: fix wrong max ID in ida_alloc_max 2023-02-01 08:34:21 +01:00
xen-blkback
zram
amiflop.c
ataflop.c
brd.c
floppy.c floppy: Fix memory leak in do_floppy_init() 2022-12-31 13:33:11 +01:00
Kconfig ublk_drv: comment on ublk_driver entry of Kconfig 2022-10-31 07:23:24 -06:00
loop.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
Makefile
n64cart.c
nbd.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
pktcdvd.c pktcdvd: check for NULL returna fter calling bio_split_to_limits() 2023-01-24 07:24:37 +01:00
ps3disk.c
ps3vram.c block: handle bio_split_to_limits() NULL return 2023-01-18 11:58:33 +01:00
rbd_types.h
rbd.c rbd: fix possible memory leak in rbd_sysfs_init() 2022-10-27 07:15:30 -06:00
sunvdc.c
swim_asm.S
swim.c
swim3.c
ublk_drv.c block: ublk: extending queue_size to fix overflow 2023-02-09 11:28:08 +01:00
virtio_blk.c virtio_blk: Fix signedness bug in virtblk_prep_rq() 2023-01-12 12:02:54 +01:00
xen-blkfront.c
z2ram.c