Commit 45126b15 authored by Jiri Olsa's avatar Jiri Olsa Committed by Andrii Nakryiko

bpf: Fix memory leak in bpf_core_apply

We need to free specs properly.

Fixes: 3d2786d6 ("bpf: correctly handle malformed BPF_CORE_TYPE_ID_LOCAL relos")
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20241007160958.607434-1-jolsa@kernel.org
parent bcd28cfd
...@@ -8961,6 +8961,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo, ...@@ -8961,6 +8961,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
if (!type) { if (!type) {
bpf_log(ctx->log, "relo #%u: bad type id %u\n", bpf_log(ctx->log, "relo #%u: bad type id %u\n",
relo_idx, relo->type_id); relo_idx, relo->type_id);
kfree(specs);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment