mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
selftests/bpf: Fix leaked bpf_link in get_stackid_cannot_attach
skel->links.oncpu is leaked in one case. This causes test perf_branches
fails when it runs after get_stackid_cannot_attach:
./test_progs -t get_stackid_cannot_attach,perf_branches
84 get_stackid_cannot_attach:OK
test_perf_branches_common:PASS:test_perf_branches_load 0 nsec
test_perf_branches_common:PASS:attach_perf_event 0 nsec
test_perf_branches_common:PASS:set_affinity 0 nsec
check_good_sample:FAIL:output not valid no valid sample from prog
146/1 perf_branches/perf_branches_hw:FAIL
146/2 perf_branches/perf_branches_no_hw:OK
146 perf_branches:FAIL
All error logs:
test_perf_branches_common:PASS:test_perf_branches_load 0 nsec
test_perf_branches_common:PASS:attach_perf_event 0 nsec
test_perf_branches_common:PASS:set_affinity 0 nsec
check_good_sample:FAIL:output not valid no valid sample from prog
146/1 perf_branches/perf_branches_hw:FAIL
146 perf_branches:FAIL
Summary: 1/1 PASSED, 0 SKIPPED, 1 FAILED
Fix this by adding the missing bpf_link__destroy().
Fixes: 346938e938
("selftests/bpf: Add get_stackid_cannot_attach")
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230412210423.900851-3-song@kernel.org
This commit is contained in:
parent
de6d014a09
commit
c1e07a80cf
1 changed files with 1 additions and 0 deletions
|
@ -65,6 +65,7 @@ void test_get_stackid_cannot_attach(void)
|
||||||
skel->links.oncpu = bpf_program__attach_perf_event(skel->progs.oncpu,
|
skel->links.oncpu = bpf_program__attach_perf_event(skel->progs.oncpu,
|
||||||
pmu_fd);
|
pmu_fd);
|
||||||
ASSERT_OK_PTR(skel->links.oncpu, "attach_perf_event_callchain");
|
ASSERT_OK_PTR(skel->links.oncpu, "attach_perf_event_callchain");
|
||||||
|
bpf_link__destroy(skel->links.oncpu);
|
||||||
close(pmu_fd);
|
close(pmu_fd);
|
||||||
|
|
||||||
/* add exclude_callchain_kernel, attach should fail */
|
/* add exclude_callchain_kernel, attach should fail */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue