提交 0c2d5728 编写于 作者: B Benjamin Tissoires 提交者: Jiri Kosina

HID: bpf: reorder BPF registration

Given that our initial BPF program is not using any kfuncs anymore,
we can reorder the initialization to first try to load it and then
register the kfuncs. This has the advantage of not exporting kfuncs
when HID-BPF is not working.
Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 bb2c0aea
...@@ -514,15 +514,16 @@ static int __init hid_bpf_init(void) ...@@ -514,15 +514,16 @@ static int __init hid_bpf_init(void)
return 0; return 0;
} }
err = register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &hid_bpf_kfunc_set); err = hid_bpf_preload_skel();
if (err) { if (err) {
pr_warn("error while setting HID BPF tracing kfuncs: %d", err); pr_warn("error while preloading HID BPF dispatcher: %d", err);
return 0; return 0;
} }
err = hid_bpf_preload_skel(); /* register tracing kfuncs after we are sure we can load our preloaded bpf program */
err = register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &hid_bpf_kfunc_set);
if (err) { if (err) {
pr_warn("error while preloading HID BPF dispatcher: %d", err); pr_warn("error while setting HID BPF tracing kfuncs: %d", err);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册