]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Cleanup the legacy uprobe_event on failed add/attach_event()
authorChuang Wang <nashuiliang@gmail.com>
Wed, 29 Jun 2022 15:18:47 +0000 (23:18 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 6 Jul 2022 04:23:03 +0000 (21:23 -0700)
commitf18ac0e1082a5c3357ad8b1a9cef7150dae8bd78
tree777cb0284845c78e21a0d861a5b1eab6e54f73c2
parentd0a2b3fbc9a7e99b081da247d82546c62880e807
libbpf: Cleanup the legacy uprobe_event on failed add/attach_event()

A potential scenario, when an error is returned after
add_uprobe_event_legacy() in perf_event_uprobe_open_legacy(), or
bpf_program__attach_perf_event_opts() in
bpf_program__attach_uprobe_opts() returns an error, the uprobe_event
that was previously created is not cleaned.

So, with this patch, when an error is returned, fix this by adding
remove_uprobe_event_legacy()

Signed-off-by: Chuang Wang <nashuiliang@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220629151848.65587-4-nashuiliang@gmail.com
tools/lib/bpf/libbpf.c