linux/arch/loongarch
Pu Lehui 47e20d4b3d LoongArch: BPF: Fix memory leak in bpf_jit_free()
When bpf_int_jit_compile() is called for subprograms, it returns early
during the first pass (!prog->is_func || extra_pass is false), keeping
ctx->offset alive for the subsequent extra pass.

If JIT compilation fails for a later subprogram, the BPF core aborts and
calls bpf_jit_free() to clean up the first subprogram. However,
bpf_jit_free() fails to free jit_data->ctx.offset, which causes a memory
leak of the JIT context offsets array.

So fix this by adding the missing kvfree(jit_data->ctx.offset) in
bpf_jit_free().

Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: 4ab17e762b ("LoongArch: BPF: Use BPF prog pack allocator")
Acked-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-07-24 16:33:08 +08:00
..
boot LoongArch: dts: Add i2c clocks and clock-frequency properties to LS2K2000 2026-06-25 13:03:57 +08:00
configs Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
include LoongArch: Increase TASK_STRUCT_OFFSET up to 2040 for 32BIT 2026-07-23 22:27:15 +08:00
kernel LoongArch: Fix oops during single-step debugging 2026-07-23 22:27:30 +08:00
kvm Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
lib LoongArch changes for v7.1 2026-04-24 09:54:45 -07:00
mm LoongArch changes for v7.2 2026-06-26 08:42:49 -07:00
net LoongArch: BPF: Fix memory leak in bpf_jit_free() 2026-07-24 16:33:08 +08:00
pci LoongArch: Add PIO for early access before ACPI PCI root register 2026-06-25 13:03:47 +08:00
power LoongArch: Adjust misc routines for 32BIT/64BIT 2025-12-08 18:09:17 +08:00
vdso LoongArch: Add build salt to the vDSO 2026-06-25 13:03:50 +08:00
Kbuild LoongArch: KVM: Compile switch.S directly into the kernel 2026-05-04 09:00:37 +08:00
Kconfig LoongArch changes for v7.2 2026-06-26 08:42:49 -07:00
Kconfig.debug LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub 2024-06-21 10:18:40 +08:00
Makefile This update includes the following changes: 2026-06-16 09:01:23 +05:30