linux-kernelorg-stable/kernel/bpf
Shardul Bankar f6fddc6df3 bpf: Fix memory leak in __lookup_instance error path
When __lookup_instance() allocates a func_instance structure but fails
to allocate the must_write_set array, it returns an error without freeing
the previously allocated func_instance. This causes a memory leak of 192
bytes (sizeof(struct func_instance)) each time this error path is triggered.

Fix by freeing 'result' on must_write_set allocation failure.

Fixes: b3698c356a ("bpf: callchain sensitive stack liveness tracking using CFG")
Reported-by: BPF Runtime Fuzzer (BRF)
Signed-off-by: Shardul Bankar <shardulsb08@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://patch.msgid.link/20251016063330.4107547-1-shardulsb08@gmail.com
2025-10-16 10:45:17 -07:00
..
preload
Kconfig
Makefile
arena.c
arraymap.c
bloom_filter.c
bpf_cgrp_storage.c
bpf_inode_storage.c
bpf_iter.c
bpf_local_storage.c
bpf_lru_list.c
bpf_lru_list.h
bpf_lsm.c
bpf_struct_ops.c
bpf_task_storage.c
btf.c
btf_iter.c
btf_relocate.c
cgroup.c
cgroup_iter.c
core.c
cpumap.c
cpumask.c
crypto.c
devmap.c
disasm.c
disasm.h
dispatcher.c
dmabuf_iter.c
hashtab.c
helpers.c bpf: Replace bpf_map_kmalloc_node() with kmalloc_nolock() to allocate bpf_async_cb structures. 2025-10-15 12:22:22 +02:00
inode.c
kmem_cache_iter.c
link_iter.c
liveness.c bpf: Fix memory leak in __lookup_instance error path 2025-10-16 10:45:17 -07:00
local_storage.c
log.c
lpm_trie.c
map_in_map.c
map_in_map.h
map_iter.c
memalloc.c
mmap_unlock_work.h
mprog.c
net_namespace.c
offload.c
percpu_freelist.c
percpu_freelist.h
prog_iter.c
queue_stack_maps.c
range_tree.c
range_tree.h
relo_core.c
reuseport_array.c
ringbuf.c
rqspinlock.c
rqspinlock.h
stackmap.c
stream.c
syscall.c bpf: Replace bpf_map_kmalloc_node() with kmalloc_nolock() to allocate bpf_async_cb structures. 2025-10-15 12:22:22 +02:00
sysfs_btf.c
task_iter.c
tcx.c
tnum.c
token.c
trampoline.c
verifier.c