selftests/bpf: Destroy XDP link correctly

bpf_link__detach() was confused with bpf_link__destroy() and leaves
leaked FD in the process. Fix the problem.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Hengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-9-andrii@kernel.org
This commit is contained in:
Andrii Nakryiko 2021-11-07 08:55:20 -08:00 коммит произвёл Alexei Starovoitov
Родитель f92321d706
Коммит f91231eeee
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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;