linux-stable/lib
Zhengchao Shao ed5cbafaf7 test_firmware: fix memory leak in test_firmware_init()
[ Upstream commit 7610615e8c ]

When misc_register() failed in test_firmware_init(), the memory pointed
by test_fw_config->name is not released. The memory leak information is
as follows:
unreferenced object 0xffff88810a34cb00 (size 32):
  comm "insmod", pid 7952, jiffies 4294948236 (age 49.060s)
  hex dump (first 32 bytes):
    74 65 73 74 2d 66 69 72 6d 77 61 72 65 2e 62 69  test-firmware.bi
    6e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  n...............
  backtrace:
    [<ffffffff81b21fcb>] __kmalloc_node_track_caller+0x4b/0xc0
    [<ffffffff81affb96>] kstrndup+0x46/0xc0
    [<ffffffffa0403a49>] __test_firmware_config_init+0x29/0x380 [test_firmware]
    [<ffffffffa040f068>] 0xffffffffa040f068
    [<ffffffff81002c41>] do_one_initcall+0x141/0x780
    [<ffffffff816a72c3>] do_init_module+0x1c3/0x630
    [<ffffffff816adb9e>] load_module+0x623e/0x76a0
    [<ffffffff816af471>] __do_sys_finit_module+0x181/0x240
    [<ffffffff89978f99>] do_syscall_64+0x39/0xb0
    [<ffffffff89a0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

Fixes: c92316bf8e ("test_firmware: add batched firmware tests")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20221119035721.18268-1-shaozhengchao@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-18 09:26:24 +01:00
..
842
crypto lib/crypto: blake2s: move hmac construction into wireguard 2022-06-25 11:46:27 +02:00
fonts Fonts: Replace discarded const qualifier 2020-11-10 10:29:03 +01:00
lz4
lzo
mpi lib/mpi: Fix 64-bit MIPS build with Clang 2020-06-20 10:25:10 +02:00
raid6 lib/raid6/test: fix multiple definition linking error 2022-04-20 09:08:12 +02:00
reed_solomon rslib: Fix handling of of caller provided syndrome 2019-07-31 07:28:30 +02:00
xz lib/xz: Validate the value before assigning it to an enum variable 2021-11-26 11:40:28 +01:00
zlib_deflate
zlib_inflate lib/zlib: remove outdated and incorrect pre-increment optimization 2020-06-25 15:41:57 +02:00
zstd
.gitignore
argv_split.c
asn1_decoder.c
assoc_array.c assoc_array: Fix BUG_ON during garbage collect 2022-06-06 08:20:56 +02:00
atomic64.c
atomic64_test.c
audit.c
bcd.c
bch.c
bitmap.c bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() 2020-01-29 15:02:39 +01:00
bitrev.c
bsearch.c kprobes: Prohibit probing on bsearch() 2019-04-05 22:31:33 +02:00
btree.c
bug.c bug: Remove redundant condition check in report_bug 2021-05-22 10:57:32 +02:00
build_OID_registry
bust_spinlocks.c
chacha20.c crypto: chacha20 - Fix chacha20_block() keystream alignment (again) 2022-06-25 11:46:31 +02:00
check_signature.c
checksum.c
clz_ctz.c
clz_tab.c
cmdline.c
compat_audit.c
cordic.c
cpu_rmap.c
cpumask.c
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c
crc4.c
crc7.c
crc8.c
crc16.c
crc32.c lib/crc32.c: fix trivial typo in preprocessor condition 2020-10-29 09:07:10 +01:00
crc32defs.h
crc32test.c lib/crc32test: remove extra local_irq_disable/enable 2020-11-10 10:29:04 +01:00
ctype.c
debug_info.c
debug_locks.c locking/lockdep: Fix debug_locks off performance problem 2018-11-13 11:14:51 -08:00
debugobjects.c debugobjects: avoid recursive calls with kmemleak 2018-12-17 09:28:54 +01:00
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlz4.c lib/decompress_unlz4.c: correctly handle zero-padding around initrds. 2021-07-20 16:17:51 +02:00
decompress_unlzma.c
decompress_unlzo.c
decompress_unxz.c lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompression 2021-11-26 11:40:28 +01:00
devres.c devres: allow const resource arguments 2020-01-27 14:46:39 +01:00
digsig.c
div64.c lib/div64.c: off by one in shift 2019-04-20 09:15:07 +02:00
dma-debug.c dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC 2022-06-14 16:53:45 +02:00
dma-noop.c
dma-virt.c
dump_stack.c dump_stack: avoid the livelock of the dump_lock 2019-11-12 19:18:01 +01:00
dynamic_debug.c dyndbg: let query-modname override actual module name 2022-10-26 13:17:04 +02:00
dynamic_queue_limits.c
earlycpio.c
errseq.c
extable.c
fault-inject.c
fdt.c
fdt_empty_tree.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_wip.c
find_bit.c uapi: rename ext2_swab() to swab() and share globally in swab.h 2020-04-24 08:00:31 +02:00
flex_array.c
flex_proportions.c
gcd.c
gen_crc32table.c
genalloc.c lib/genalloc: fix the overflow when size is too big 2021-01-12 20:09:06 +01:00
glob.c
globtest.c
hexdump.c hex2bin: fix access beyond string end 2022-05-12 12:17:06 +02:00
hweight.c
idr.c ida: don't use BUG_ON() for debugging 2022-07-12 16:27:29 +02:00
inflate.c
int_sqrt.c lib/int_sqrt: optimize initial value compute 2019-04-05 22:31:24 +02:00
interval_tree.c
interval_tree_test.c lib/rbtree-test: lower default params 2018-12-17 09:28:55 +01:00
iomap.c
iomap_copy.c
iommu-common.c
iommu-helper.c
ioremap.c
iov_iter.c lib/iov_iter: initialize "flags" in new pipe_buffer 2022-02-23 11:57:35 +01:00
irq_poll.c
irq_regs.c
is_single_threaded.c
jedec_ddr_data.c
kasprintf.c
Kconfig ARM: 9178/1: fix unmet dependency on BITREVERSE for HAVE_ARCH_BITREVERSE 2022-03-23 09:01:34 +01:00
Kconfig.debug random: remove ratelimiting for in-kernel unseeded randomness 2022-06-25 11:46:40 +02:00
Kconfig.kasan
Kconfig.kgdb
Kconfig.ubsan
kfifo.c Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()" 2020-01-27 14:46:44 +01:00
klist.c
kobject.c kobject: Replace strncpy with memcpy 2018-12-08 13:03:35 +01:00
kobject_uevent.c kobject_uevent: remove warning in init_uevent_argv() 2021-05-22 10:57:41 +02:00
kstrtox.c lib: vsprintf: Fix handling of number field widths in vsscanf 2021-07-20 16:17:33 +02:00
kstrtox.h lib: vsprintf: Fix handling of number field widths in vsscanf 2021-07-20 16:17:33 +02:00
lcm.c
libcrc32c.c
list_debug.c
list_sort.c
llist.c
locking-selftest-hardirq.h
locking-selftest-mutex.h
locking-selftest-rlock-hardirq.h
locking-selftest-rlock-softirq.h
locking-selftest-rlock.h
locking-selftest-rsem.h
locking-selftest-rtmutex.h
locking-selftest-softirq.h
locking-selftest-spin-hardirq.h
locking-selftest-spin-softirq.h
locking-selftest-spin.h
locking-selftest-wlock-hardirq.h
locking-selftest-wlock-softirq.h
locking-selftest-wlock.h
locking-selftest-wsem.h
locking-selftest.c
lockref.c
lru_cache.c
Makefile crypto: blake2s - generic C library implementation and selftest 2022-06-25 11:46:27 +02:00
memory-notifier-error-inject.c
memweight.c
net_utils.c
netdev-notifier-error-inject.c
nlattr.c net: fix nla_strcmp to handle more then one trailing null character 2021-05-22 10:57:39 +02:00
nmi_backtrace.c
nodemask.c nodemask: Fix return values to be unsigned 2022-06-14 16:54:01 +02:00
notifier-error-inject.c lib/notifier-error-inject: fix error when writing -errno to debugfs file 2023-01-18 09:26:10 +01:00
notifier-error-inject.h
of-reconfig-notifier-error-inject.c
oid_registry.c
once.c once: add DO_ONCE_SLOW() for sleepable contexts 2023-01-18 09:26:04 +01:00
parman.c
parser.c
pci_iomap.c
percpu-refcount.c
percpu_counter.c
percpu_ida.c
percpu_test.c
plist.c
pm-notifier-error-inject.c
prime_numbers.c
radix-tree.c idr: Fix idr_alloc_u32 on 32-bit systems 2019-12-05 15:36:53 +01:00
random32.c random: replace custom notifier chain with standard one 2022-06-25 11:46:36 +02:00
ratelimit.c ratelimit: Fix data-races in ___ratelimit(). 2022-09-05 10:25:04 +02:00
rational.c
rbtree.c
rbtree_test.c lib/rbtree-test: lower default params 2018-12-17 09:28:55 +01:00
reciprocal_div.c
refcount.c
rhashtable.c rhashtable: Still do rehash when we get EEXIST 2019-04-03 06:25:09 +02:00
sbitmap.c sbitmap: fix improper use of smp_mb__before_atomic() 2019-05-31 06:47:10 -07:00
scatterlist.c sgl_alloc_order: fix memory leak 2020-11-05 11:06:58 +01:00
seq_buf.c seq_buf: Fix overflow in seq_buf_putmem_hex() 2021-07-20 16:17:47 +02:00
sg_pool.c
sg_split.c
sha1.c lib/crypto: sha1: re-roll loops to reduce code size 2022-06-25 11:46:27 +02:00
show_mem.c
siphash.c siphash: use one source of truth for siphash permutations 2022-06-25 11:46:39 +02:00
smp_processor_id.c
sort.c
stackdepot.c lib: stackdepot: turn depot_lock spinlock to raw_spinlock 2021-05-22 10:57:43 +02:00
stmp_device.c
string.c lib/string: Add strscpy_pad() function 2021-02-23 14:00:30 +01:00
string_helpers.c
strncpy_from_user.c lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() 2020-06-20 10:24:58 +02:00
strnlen_user.c lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() 2020-06-20 10:24:58 +02:00
swiotlb.c swiotlb: skip swiotlb_bounce when orig_addr is zero 2022-07-02 16:18:11 +02:00
syscall.c
test-kstrtox.c
test-string_helpers.c
test_bitmap.c
test_bpf.c bpf: add also cbpf long jump test cases with heavy expansion 2021-10-17 10:08:32 +02:00
test_debug_virtual.c lib: fix build failure in CONFIG_DEBUG_VIRTUAL test 2019-01-13 10:01:07 +01:00
test_firmware.c test_firmware: fix memory leak in test_firmware_init() 2023-01-18 09:26:24 +01:00
test_hash.c
test_hexdump.c test_hexdump: use memcpy instead of strncpy 2018-12-08 13:03:35 +01:00
test_kasan.c lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() 2020-02-14 16:32:08 -05:00
test_kmod.c lib/test: use after free in register_test_dev_kmod() 2022-04-20 09:08:21 +02:00
test_list_sort.c
test_module.c
test_parman.c
test_printf.c
test_rhashtable.c
test_siphash.c
test_sort.c
test_static_key_base.c
test_static_keys.c
test_sysctl.c
test_user_copy.c
test_uuid.c
textsearch.c
timerqueue.c lib/timerqueue: Rely on rbtree semantics for next timer 2021-10-09 14:09:46 +02:00
ts_bm.c
ts_fsm.c
ts_kmp.c
ubsan.c ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings 2019-05-10 17:53:08 +02:00
ubsan.h
ucs2_string.c
usercopy.c
uuid.c
vsprintf.c lib: vsprintf: Fix handling of number field widths in vsscanf 2021-07-20 16:17:33 +02:00
win_minmax.c
xxhash.c