]> git.baikalelectronics.ru Git - kernel.git/commit
riscv, bpf: Fix potential NULL dereference
authorBjörn Töpel <bjorn@kernel.org>
Thu, 28 Oct 2021 12:51:15 +0000 (14:51 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 28 Oct 2021 15:14:30 +0000 (08:14 -0700)
commit912725c74e721dae8ddcc936e97cb0eeb15f1797
tree2d56959a9820f52d44b59e5410c44d8de01f2879
parentd3124e1fed25bd3263f26a52f1aac7fe43818543
riscv, bpf: Fix potential NULL dereference

The bpf_jit_binary_free() function requires a non-NULL argument. When
the RISC-V BPF JIT fails to converge in NR_JIT_ITERATIONS steps,
jit_data->header will be NULL, which triggers a NULL
dereference. Avoid this by checking the argument, prior calling the
function.

Fixes: fc9e0133467d ("riscv, bpf: Factor common RISC-V JIT code")
Signed-off-by: Björn Töpel <bjorn@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20211028125115.514587-1-bjorn@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
arch/riscv/net/bpf_jit_core.c