Message ID | 20230120122148.1522359-1-jolsa@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 74bc3a5acc82f020d2e126f56c535d02d1e74e37 |
Delegated to: | BPF |
Headers | show |
Series | [PATCHv2,bpf] bpf: Add missing btf_put to register_btf_id_dtor_kfuncs | expand |
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!
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; }