android_kernel_motorola_sm6375/drivers/block
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Siddh Raman Pant 13b2856037 loop: Check for overflow while configuring loop
commit c490a0b5a4f36da3918181a8acdc6991d967c5f3 upstream.

The userspace can configure a loop using an ioctl call, wherein
a configuration of type loop_config is passed (see lo_ioctl()'s
case on line 1550 of drivers/block/loop.c). This proceeds to call
loop_configure() which in turn calls loop_set_status_from_info()
(see line 1050 of loop.c), passing &config->info which is of type
loop_info64*. This function then sets the appropriate values, like
the offset.

loop_device has lo_offset of type loff_t (see line 52 of loop.c),
which is typdef-chained to long long, whereas loop_info64 has
lo_offset of type __u64 (see line 56 of include/uapi/linux/loop.h).

The function directly copies offset from info to the device as
follows (See line 980 of loop.c):
	lo->lo_offset = info->lo_offset;

This results in an overflow, which triggers a warning in iomap_iter()
due to a call to iomap_iter_done() which has:
	WARN_ON_ONCE(iter->iomap.offset > iter->pos);

Thus, check for negative value during loop_set_status_from_info().

Bug report: https://syzkaller.appspot.com/bug?id=c620fe14aac810396d3c3edc9ad73848bf69a29e

Reported-and-tested-by: syzbot+a8e049cd3abd342936b6@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220823160810.181275-1-code@siddh.me
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-05 10:27:43 +02:00
..
aoe
drbd drbd: fix duplicate array initializer 2022-06-14 18:11:33 +02:00
mtip32xx
paride
rsxx
xen-blkback
zram zram: off by one in read_block_state() 2021-11-17 09:48:47 +01:00
amiflop.c
ataflop.c block: ataflop: fix breakage introduced at blk-mq refactoring 2021-11-17 09:48:38 +01:00
brd.c
cryptoloop.c cryptoloop: add a deprecation warning 2021-09-12 08:56:40 +02:00
floppy.c floppy: use a statically allocated error counter 2022-05-25 09:14:31 +02:00
Kconfig floppy: disable FDRAWCMD by default 2022-05-09 09:03:20 +02:00
loop.c loop: Check for overflow while configuring loop 2022-09-05 10:27:43 +02:00
loop.h
Makefile
nbd.c nbd: fix io hung while disconnecting device 2022-06-14 18:12:01 +02:00
null_blk.h
null_blk_main.c null_blk: fix ida error handling in null_add_dev() 2022-08-25 11:17:59 +02:00
null_blk_zoned.c
pktcdvd.c
ps3disk.c
ps3vram.c
rbd.c rbd: always kick acquire on "acquired" and "released" notifications 2021-07-28 13:31:01 +02:00
rbd_types.h
skd_main.c
skd_s1120.h
sunvdc.c
swim.c
swim3.c
swim_asm.S
sx8.c
umem.c
umem.h
virtio_blk.c virtio_blk: fix the discard_granularity and discard_alignment queue limits 2022-06-14 18:11:35 +02:00
xen-blkfront.c xen/blkfront: force data bouncing when backend is untrusted 2022-07-07 17:36:53 +02:00
xsysace.c
z2ram.c