]> Git Repo - linux.git/commitdiff
bpf: Fix memleak in aux->func_info and aux->btf
authorMartin KaFai Lau <[email protected]>
Sun, 2 Dec 2018 01:08:44 +0000 (17:08 -0800)
committerAlexei Starovoitov <[email protected]>
Sun, 2 Dec 2018 17:12:58 +0000 (09:12 -0800)
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 <[email protected]>
Signed-off-by: Martin KaFai Lau <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
kernel/bpf/syscall.c

index f9554d9a14e18840c61436ce32f58070c88a690f..4445d0d084d88f2b193a43369fab037920848e9c 100644 (file)
@@ -1560,6 +1560,8 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
        return err;
 
 free_used_maps:
+       kvfree(prog->aux->func_info);
+       btf_put(prog->aux->btf);
        bpf_prog_kallsyms_del_subprogs(prog);
        free_used_maps(prog->aux);
 free_prog:
This page took 0.046903 seconds and 4 git commands to generate.