bpf_int_jit_compile() keeps the context of a subprog after its first run in jit_data, with the offset table, for the extra pass, which frees both. When the JIT of a later subprog fails, jit_subprogs() frees the subprogs JITed so far through bpf_jit_free(), which frees jit_data but not the offset table in it, so every such failure leaks the table. Free the offset table there as well, as the x86, riscv and LoongArch JITs do. Fixes: db496944fdaa ("bpf: arm64: add JIT support for multi-function programs") Signed-off-by: Daniel Borkmann --- arch/arm64/net/bpf_jit_comp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index e99f105b7f61..19c986440235 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -3580,6 +3580,7 @@ void bpf_jit_free(struct bpf_prog *prog) */ if (jit_data) { bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header); + kvfree(jit_data->ctx.offset); kfree(jit_data); } prog->bpf_func = (void *)prog->bpf_func - cfi_get_offset(); -- 2.43.0