Skip to content

Commit

Permalink
selftests/bpf: Destroy XDP link correctly
Browse files Browse the repository at this point in the history
bpf_link__detach() was confused with bpf_link__destroy() and leaves
leaked FD in the process. Fix the problem.

Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Reviewed-by: Hengqi Chen <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
anakryiko authored and Alexei Starovoitov committed Nov 7, 2021
1 parent f92321d commit f91231e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ static int pass_ack(struct migrate_reuseport_test_case *test_case)
{
int err;

err = bpf_link__detach(test_case->link);
if (!ASSERT_OK(err, "bpf_link__detach"))
err = bpf_link__destroy(test_case->link);
if (!ASSERT_OK(err, "bpf_link__destroy"))
return -1;

test_case->link = NULL;
Expand Down

0 comments on commit f91231e

Please sign in to comment.