kernel_samsung_a53x/drivers/block
Kairui Song 2443085c28 zram: refuse to use zero sized block device as backing device
commit be48c412f6ebf38849213c19547bc6d5b692b5e5 upstream.

Patch series "zram: fix backing device setup issue", v2.

This series fixes two bugs of backing device setting:

- ZRAM should reject using a zero sized (or the uninitialized ZRAM
  device itself) as the backing device.
- Fix backing device leaking when removing a uninitialized ZRAM
  device.


This patch (of 2):

Setting a zero sized block device as backing device is pointless, and one
can easily create a recursive loop by setting the uninitialized ZRAM
device itself as its own backing device by (zram0 is uninitialized):

    echo /dev/zram0 > /sys/block/zram0/backing_dev

It's definitely a wrong config, and the module will pin itself, kernel
should refuse doing so in the first place.

By refusing to use zero sized device we avoided misuse cases including
this one above.

Link: https://lkml.kernel.org/r/20241209165717.94215-1-ryncsn@gmail.com
Link: https://lkml.kernel.org/r/20241209165717.94215-2-ryncsn@gmail.com
Fixes: 013bf95a83ec ("zram: add interface to specif backing device")
Signed-off-by: Kairui Song <kasong@tencent.com>
Reported-by: Desheng Wu <deshengwu@tencent.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-15 16:29:45 +01:00
..
aoe Revert "aoe: fix the potential use-after-free problem in more places" 2024-11-24 00:23:02 +01:00
drbd Revert "drbd: Fix atomicity violation in drbd_uuid_set_bm()" 2024-11-24 00:23:16 +01:00
mtip32xx
null_blk null_blk: fix validation of block size 2024-11-19 14:19:47 +01:00
paride
rnbd
rsxx
xen-blkback
zram zram: refuse to use zero sized block device as backing device 2025-01-15 16:29:45 +01:00
amiflop.c
ataflop.c block: ataflop: more blk-mq refactoring fixes 2024-11-18 22:25:42 +01:00
brd.c
cryptoloop.c
floppy.c
Kconfig
loop.c
loop.h
Makefile
nbd.c nbd: null check for nla_nest_start 2024-11-19 08:44:37 +01:00
pktcdvd.c
ps3disk.c
ps3vram.c
rbd.c rbd: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings 2024-11-23 23:20:16 +01:00
rbd_types.h
skd_main.c
skd_s1120.h
sunvdc.c
swim.c
swim3.c
swim_asm.S
umem.c
umem.h
virtio_blk.c virtio-blk: Ensure no requests in virtqueues before deleting vqs. 2024-11-18 22:25:34 +01:00
xen-blkfront.c
xsysace.c
z2ram.c