linux-stable/drivers/mtd
Zhihao Cheng 04c0b0f376 ubi: fastmap: Fix duplicate slab cache names while attaching
[ Upstream commit bcddf52b7a ]

Since commit 4c39529663 ("slab: Warn on duplicate cache names when
DEBUG_VM=y"), the duplicate slab cache names can be detected and a
kernel WARNING is thrown out.
In UBI fast attaching process, alloc_ai() could be invoked twice
with the same slab cache name 'ubi_aeb_slab_cache', which will trigger
following warning messages:
 kmem_cache of name 'ubi_aeb_slab_cache' already exists
 WARNING: CPU: 0 PID: 7519 at mm/slab_common.c:107
          __kmem_cache_create_args+0x100/0x5f0
 Modules linked in: ubi(+) nandsim [last unloaded: nandsim]
 CPU: 0 UID: 0 PID: 7519 Comm: modprobe Tainted: G 6.12.0-rc2
 RIP: 0010:__kmem_cache_create_args+0x100/0x5f0
 Call Trace:
   __kmem_cache_create_args+0x100/0x5f0
   alloc_ai+0x295/0x3f0 [ubi]
   ubi_attach+0x3c3/0xcc0 [ubi]
   ubi_attach_mtd_dev+0x17cf/0x3fa0 [ubi]
   ubi_init+0x3fb/0x800 [ubi]
   do_init_module+0x265/0x7d0
   __x64_sys_finit_module+0x7a/0xc0

The problem could be easily reproduced by loading UBI device by fastmap
with CONFIG_DEBUG_VM=y.
Fix it by using different slab names for alloc_ai() callers.

Fixes: d2158f69a7 ("UBI: Remove alloc_ai() slab name from parameter list")
Fixes: fdf10ed710 ("ubi: Rework Fastmap attach base code")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 19:48:14 +01:00
..
chips mtd: cfi_cmdset_0001: Byte swap OTP info 2023-11-28 16:54:58 +00:00
devices mtd: powernv: Add check devm_kasprintf() returned value 2024-10-17 15:07:45 +02:00
hyperbus mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove 2022-01-27 10:53:50 +01:00
lpddr mtd: lpddr2_nvm: Fix possible null-ptr-deref 2023-01-14 10:15:30 +01:00
maps mtd: maps: physmap-core: fix flash size larger than 32-bit 2024-03-26 18:21:58 -04:00
nand mtd: rawnand: atmel: Fix possible memory leak 2024-12-14 19:47:58 +01:00
parsers mtd: partitions: redboot: Added conversion of operands to a larger type 2024-07-05 09:12:49 +02:00
spi-nor mtd: spi-nor: Check bus width while setting QE bit 2023-09-19 12:20:20 +02:00
tests mtd: make mtd_test.c a separate module 2024-08-19 05:40:52 +02:00
ubi ubi: fastmap: Fix duplicate slab cache names while attaching 2024-12-14 19:48:14 +01:00
ftl.c
inftlcore.c
inftlmount.c
Kconfig mtd: Support kmsg dumper based on pstore/blk 2020-05-31 19:49:01 -07:00
Makefile mtd: Support kmsg dumper based on pstore/blk 2020-05-31 19:49:01 -07:00
mtd_blkdevs.c mtd: Fix gluebi NULL pointer dereference caused by ftl notifier 2024-01-25 14:37:41 -08:00
mtdblock_ro.c
mtdblock.c mtdblock: tolerate corrected bit-flips 2023-04-20 12:10:25 +02:00
mtdchar.c mtd: require write permissions for locking and badblock ioctls 2021-05-14 09:50:13 +02:00
mtdconcat.c mtd: mtdconcat: Check _read, _write callbacks existence before assignment 2021-09-22 12:28:03 +02:00
mtdcore.c mtd: Fix device name leak when register device failed in add_mtd_device() 2023-01-14 10:15:28 +01:00
mtdcore.h
mtdoops.c mtd: mtdoops: Don't write panic data twice 2020-09-07 14:22:12 +02:00
mtdpart.c mtd: Fixed breaking list in __mtd_del_partition. 2022-01-27 10:53:41 +01:00
mtdpstore.c iov_iter: Move unnecessary inclusion of crypto/hash.h 2020-06-30 09:34:23 -04:00
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c
rfd_ftl.c
sm_ftl.c mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release 2022-08-21 15:15:53 +02:00
sm_ftl.h
ssfdc.c