mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 21:15:53 +02:00
bpf: Add missing btf_put to register_btf_id_dtor_kfuncs
[ Upstream commit74bc3a5acc] 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:5ce937d613("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> Link: https://lore.kernel.org/r/20230120122148.1522359-1-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d52f34784e
commit
d5c7a2ab5e
|
|
@ -7607,9 +7607,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user