summaryrefslogtreecommitdiff
path: root/kernel/bpf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2024-10-07 18:09:58 +0200
committerAndrii Nakryiko <andrii@kernel.org>2024-10-07 20:28:24 -0700
commit45126b155e3b5201179cdc038504bf93a8ccd921 (patch)
tree8007768f96a49de99729d44de9a66981b756caa2 /kernel/bpf
parentbcd28cfd04ebd3f871443e4746e511147686e517 (diff)
bpf: Fix memory leak in bpf_core_apply
We need to free specs properly. Fixes: 3d2786d65aaa ("bpf: correctly handle malformed BPF_CORE_TYPE_ID_LOCAL relos") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/20241007160958.607434-1-jolsa@kernel.org
Diffstat (limited to 'kernel/bpf')
-rw-r--r--kernel/bpf/btf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 75e4fe83c509..a05da5f43547 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -8961,6 +8961,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
if (!type) {
bpf_log(ctx->log, "relo #%u: bad type id %u\n",
relo_idx, relo->type_id);
+ kfree(specs);
return -EINVAL;
}