Skip to content

Commit 5482e9a

Browse files
iamkafaiAlexei Starovoitov
authored andcommitted
bpf: Fix memleak in aux->func_info and aux->btf
The aux->func_info and aux->btf are leaked in the error out cases during bpf_prog_load(). This patch fixes it. Fixes: ba64e7d ("bpf: btf: support proper non-jit func info") Cc: Yonghong Song <yhs@fb.com> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 71fc156 commit 5482e9a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/syscall.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,8 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
15601560
return err;
15611561

15621562
free_used_maps:
1563+
kvfree(prog->aux->func_info);
1564+
btf_put(prog->aux->btf);
15631565
bpf_prog_kallsyms_del_subprogs(prog);
15641566
free_used_maps(prog->aux);
15651567
free_prog:

0 commit comments

Comments
 (0)