* [PATCHv2 bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs
@ 2023-01-20 12:21 Jiri Olsa
2023-01-20 16:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2023-01-20 12:21 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
Cc: Kumar Kartikeya Dwivedi, bpf, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo
We take the BTF reference before we register dtors and we need
to put it back when it's done.
We probably won't se a problem with kernel BTF, but module BTF
would stay loaded (because of the extra ref) even when its module
is removed.
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Fixes: 5ce937d613a4 ("bpf: Populate pairs of btf_id and destructor kfunc in btf")
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
v2 changes:
- resend and added Kumar's ack
kernel/bpf/btf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index f7dd8af06413..b7017cae6fd1 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -7782,9 +7782,9 @@ int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32 add_c
sort(tab->dtors, tab->cnt, sizeof(tab->dtors[0]), btf_id_cmp_func, NULL);
- return 0;
end:
- btf_free_dtor_kfunc_tab(btf);
+ if (ret)
+ btf_free_dtor_kfunc_tab(btf);
btf_put(btf);
return ret;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2 bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs
2023-01-20 12:21 [PATCHv2 bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs Jiri Olsa
@ 2023-01-20 16:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-20 16:30 UTC (permalink / raw)
To: Jiri Olsa
Cc: ast, daniel, andrii, memxor, bpf, kafai, songliubraving, yhs,
john.fastabend, kpsingh, sdf, haoluo
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 20 Jan 2023 13:21:48 +0100 you wrote:
> We take the BTF reference before we register dtors and we need
> to put it back when it's done.
>
> We probably won't se a problem with kernel BTF, but module BTF
> would stay loaded (because of the extra ref) even when its module
> is removed.
>
> [...]
Here is the summary with links:
- [PATCHv2,bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs
https://git.kernel.org/bpf/bpf/c/74bc3a5acc82
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-20 16:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-20 12:21 [PATCHv2 bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs Jiri Olsa
2023-01-20 16:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox