linux-stable/drivers/block
Zhong Jinghua 9f6ad5d533 loop: loop_set_status_from_info() check before assignment
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>
2023-02-22 20:43:09 -07:00
..
aoe driver core: make struct class.devnode() take a const * 2022-11-24 17:12:27 +01:00
drbd drbd: drbd_insert_interval(): Clarify comment 2023-01-29 15:18:33 -07:00
mtip32xx block: move from strlcpy with unused retval to strscpy 2022-09-21 19:45:04 -06:00
null_blk block: make BLK_DEF_MAX_SECTORS unsigned 2023-01-29 15:18:33 -07: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 block/rnbd-clt: fix wrong max ID in ida_alloc_max 2023-01-17 08:33:36 -07:00
xen-blkback xen: make remove callback of xen driver void returned 2022-12-15 16:06:10 +01:00
zram zram: use bvec_set_page to initialize bvecs 2023-02-03 08:20:55 -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 brd: use radix_tree_maybe_preload instead of radix_tree_preload 2023-02-17 06:15:53 -07:00
floppy.c floppy: Fix memory leak in do_floppy_init() 2022-12-04 18:03:41 +04:00
Kconfig Revert "pktcdvd: remove driver." 2023-01-04 14:44:13 -07:00
loop.c loop: loop_set_status_from_info() check before assignment 2023-02-22 20:43:09 -07:00
Makefile Revert "pktcdvd: remove driver." 2023-01-04 14:44:13 -07:00
n64cart.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
nbd.c Treewide: Stop corrupting socket's task_frag 2022-12-19 17:28:49 -08:00
pktcdvd.c pktcdvd: check for NULL returna fter calling bio_split_to_limits() 2023-01-16 08:51:05 -07:00
ps3disk.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ps3vram.c ps3vram: remove bio splitting 2023-01-29 15:18:35 -07:00
rbd.c rbd: use bvec_set_page to initialize the copy up bvec 2023-02-03 08:20:55 -07:00
rbd_types.h libceph, rbd: replace zero-length array with flexible-array 2020-06-01 13:22:53 +02:00
sunvdc.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
swim.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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ublk_drv.c ublk: remove check IO_URING_F_SQE128 in ublk_ch_uring_cmd 2023-02-21 09:27:23 -07:00
virtio_blk.c virtio_blk: use bvec_set_virt to initialize special_vec 2023-02-03 08:20:55 -07:00
xen-blkfront.c xen: branch for v6.2-rc4 2023-01-12 17:02:20 -06:00
z2ram.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00