* [PATCH bpf-next] bpf: Fix memleak in aux->func_info and aux->btf
@ 2018-12-02 1:08 Martin KaFai Lau
2018-12-02 17:15 ` Alexei Starovoitov
0 siblings, 1 reply; 2+ messages in thread
From: Martin KaFai Lau @ 2018-12-02 1:08 UTC (permalink / raw)
To: netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, Yonghong Song
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>
---
kernel/bpf/syscall.c | 2 ++
1 file changed, 2 insertions(+)
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)
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:
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: Fix memleak in aux->func_info and aux->btf
2018-12-02 1:08 [PATCH bpf-next] bpf: Fix memleak in aux->func_info and aux->btf Martin KaFai Lau
@ 2018-12-02 17:15 ` Alexei Starovoitov
0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2018-12-02 17:15 UTC (permalink / raw)
To: Martin KaFai Lau
Cc: netdev, Alexei Starovoitov, Daniel Borkmann, kernel-team,
Yonghong Song
On Sat, Dec 01, 2018 at 05:08:44PM -0800, Martin KaFai Lau wrote:
> 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>
Applied, Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-02 17:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-02 1:08 [PATCH bpf-next] bpf: Fix memleak in aux->func_info and aux->btf Martin KaFai Lau
2018-12-02 17:15 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).