]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, x64: fix memleak when not converging after image
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 2 May 2018 18:12:22 +0000 (20:12 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 2 May 2018 19:35:47 +0000 (12:35 -0700)
commit97b0648d32a4b59cb9cd2665ec8851fee80a6662
tree463a04b0982e85329b6dbec84ca8f9588661afaf
parent72178cae219ab3c9d7db3815f2ff97a0875f8878
bpf, x64: fix memleak when not converging after image

While reviewing x64 JIT code, I noticed that we leak the prior allocated
JIT image in the case where proglen != oldproglen during the JIT passes.
Prior to the commit c9d9708e0905 ("x86: bpf_jit: fix two bugs in eBPF JIT
compiler") we would just break out of the loop, and using the image as the
JITed prog since it could only shrink in size anyway. After c9d9708e0905,
we would bail out to out_addrs label where we free addrs and jit_data but
not the image coming from bpf_jit_binary_alloc().

Fixes: c9d9708e0905 ("x86: bpf_jit: fix two bugs in eBPF JIT compiler")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/x86/net/bpf_jit_comp.c