linux-sg2042/drivers/block
Andrey Skvortsov 6e20720b12 zram: don't free statically defined names
[ Upstream commit 486fd58af7 ]

When CONFIG_ZRAM_MULTI_COMP isn't set ZRAM_SECONDARY_COMP can hold
default_compressor, because it's the same offset as ZRAM_PRIMARY_COMP, so
we need to make sure that we don't attempt to kfree() the statically
defined compressor name.

This is detected by KASAN.

==================================================================
  Call trace:
   kfree+0x60/0x3a0
   zram_destroy_comps+0x98/0x198 [zram]
   zram_reset_device+0x22c/0x4a8 [zram]
   reset_store+0x1bc/0x2d8 [zram]
   dev_attr_store+0x44/0x80
   sysfs_kf_write+0xfc/0x188
   kernfs_fop_write_iter+0x28c/0x428
   vfs_write+0x4dc/0x9b8
   ksys_write+0x100/0x1f8
   __arm64_sys_write+0x74/0xb8
   invoke_syscall+0xd8/0x260
   el0_svc_common.constprop.0+0xb4/0x240
   do_el0_svc+0x48/0x68
   el0_svc+0x40/0xc8
   el0t_64_sync_handler+0x120/0x130
   el0t_64_sync+0x190/0x198
==================================================================

Link: https://lkml.kernel.org/r/20240923164843.1117010-1-andrej.skvortzov@gmail.com
Fixes: 684826f827 ("zram: free secondary algorithms names")
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reported-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Closes: https://lore.kernel.org/lkml/57130e48-dbb6-4047-a8c7-ebf5aaea93f4@linux.vnet.ibm.com/
Tested-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Cc: Chris Li <chrisl@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-17 15:24:14 +02:00
..
aoe aoe: fix the potential use-after-free problem in more places 2024-10-10 11:57:53 +02:00
drbd drbd: Add NULL check for net_conf to prevent dereference in state validation 2024-10-04 16:29:52 +02:00
mtip32xx block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
null_blk null_blk: Fix return value of nullb_device_power_store() 2024-10-10 11:58:09 +02:00
rnbd block/rnbd-srv: Check for unlikely string overflow 2024-02-05 20:14:22 +00:00
xen-blkback block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
zram zram: don't free statically defined names 2024-10-17 15:24:14 +02:00
Kconfig block: ublk: switch to ioctl command encoding 2023-04-18 20:13:30 -06:00
Makefile Revert "pktcdvd: remove driver." 2023-01-04 14:44:13 -07:00
amiflop.c amiflop: don't call fsync_bdev in FDFMTBEG 2023-08-21 14:35:31 +02:00
ataflop.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
brd.c brd: use cond_resched instead of cond_resched_rcu 2023-06-14 11:13:07 -06:00
floppy.c floppy: call disk_force_media_change when changing the format 2023-08-21 14:35:31 +02:00
loop.c loop: don't set QUEUE_FLAG_NOMERGES 2024-10-10 11:57:18 +02:00
n64cart.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
nbd.c nbd: fix race between timeout and normal completion 2024-10-04 16:28:59 +02:00
pktcdvd.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06: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: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings 2024-08-03 08:54:32 +02:00
rbd_types.h libceph, rbd: replace zero-length array with flexible-array 2020-06-01 13:22:53 +02:00
sunvdc.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
swim.c swim: fix a missing FMODE_ -> BLK_OPEN_ conversion in floppy_open 2023-06-20 07:16:04 -06:00
swim3.c swim3: mark swim3_init() static 2023-08-10 08:32:59 -06:00
swim_asm.S
ublk_drv.c ublk: move zone report data out of request pdu 2024-10-04 16:28:59 +02:00
virtio_blk.c virtio-blk: Ensure no requests in virtqueues before deleting vqs. 2024-03-01 13:34:56 +01:00
xen-blkfront.c for-6.5/block-2023-06-23 2023-06-26 12:47:20 -07:00
z2ram.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00