acrn-kernel/drivers/block
Zhong Jinghua 4be26d553a loop: loop_set_status_from_info() check before assignment
[ Upstream commit 9f6ad5d533 ]

In loop_set_status_from_info(), lo->lo_offset and lo->lo_sizelimit should
be checked before reassignment, because if an overflow error occurs, the
original correct value will be changed to the wrong value, and it will not
be changed back.

More, the original patch did not solve the problem, the value was set and
ioctl returned an error, but the subsequent io used the value in the loop
driver, which still caused an alarm:

loop_handle_cmd
 do_req_filebacked
  loff_t pos = ((loff_t) blk_rq_pos(rq) << 9) + lo->lo_offset;
  lo_rw_aio
   cmd->iocb.ki_pos = pos

Fixes: c490a0b5a4 ("loop: Check for overflow while configuring loop")
Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20230221095027.3656193-1-zhongjinghua@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-11 13:55:30 +01:00
..
aoe block: aoe: use DEFINE_SHOW_ATTRIBUTE to simplify aoe_debugfs 2022-09-21 19:49:24 -06:00
drbd use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01: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
rnbd block/rnbd-clt: fix wrong max ID in ida_alloc_max 2023-02-01 08:34:21 +01:00
xen-blkback xen: branch for v6.0-rc4 2022-09-03 13:23:11 -07:00
zram - Alistair Popple has a series which addresses a race which causes page 2022-10-14 12:28:43 -07:00
Kconfig ublk_drv: comment on ublk_driver entry of Kconfig 2022-10-31 07:23:24 -06:00
Makefile remove the sx8 block driver 2022-08-02 17:22:46 -06:00
amiflop.c
ataflop.c
brd.c brd: use radix_tree_maybe_preload instead of radix_tree_preload 2023-03-10 09:34:34 +01:00
floppy.c floppy: Fix memory leak in do_floppy_init() 2022-12-31 13:33:11 +01:00
loop.c loop: loop_set_status_from_info() check before assignment 2023-03-11 13:55:30 +01:00
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.c rbd: avoid use-after-free in do_rbd_add() when rbd_dev_create() fails 2023-03-10 09:34:25 +01:00
rbd_types.h
sunvdc.c
swim.c
swim3.c
swim_asm.S
ublk_drv.c block: ublk: check IO buffer based on flag need_get_data 2023-03-10 09:32:46 +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 xen: branch for v6.0-rc4 2022-09-03 13:23:11 -07:00
z2ram.c