diff options
author | Martin KaFai Lau <kafai@fb.com> | 2018-12-01 20:08:44 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-12-02 12:12:58 -0500 |
commit | 5482e9a93c83839f94e75db712e6837e6a39962c (patch) | |
tree | 4a6563610f69436aa35887e450992e7fb8a941d9 /kernel/bpf/syscall.c | |
parent | 71fc156ff5361beb1fb4c519add1f1ebda33ff13 (diff) |
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: ba64e7d85252 ("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>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index f9554d9a14e1..4445d0d084d8 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -1560,6 +1560,8 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr) | |||
1560 | return err; | 1560 | return err; |
1561 | 1561 | ||
1562 | free_used_maps: | 1562 | free_used_maps: |
1563 | kvfree(prog->aux->func_info); | ||
1564 | btf_put(prog->aux->btf); | ||
1563 | bpf_prog_kallsyms_del_subprogs(prog); | 1565 | bpf_prog_kallsyms_del_subprogs(prog); |
1564 | free_used_maps(prog->aux); | 1566 | free_used_maps(prog->aux); |
1565 | free_prog: | 1567 | free_prog: |