Commit 18a8a4c8 authored by Martin KaFai Lau's avatar Martin KaFai Lau

Merge branch 'BPF selftests misc fixes'

Geliang Tang says:

====================
v2:
 - only check the first "link" (link_nl) in test_mixed_links().
 - Drop patch 2 in v1.

This patchset fixes a segfault and a bpf object leak in test_progs.

It is a resend patch 1 out of "skip ENOTSUPP BPF selftests" set as Eduard
suggested. Together with another fix for xdp_adjust_tail.
====================
Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parents ec5b8c76 52b49ec1
......@@ -411,7 +411,8 @@ static void test_update_ca(void)
return;
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
ASSERT_OK_PTR(link, "attach_struct_ops");
if (!ASSERT_OK_PTR(link, "attach_struct_ops"))
goto out;
do_test(&opts);
saved_ca1_cnt = skel->bss->ca1_cnt;
......@@ -425,6 +426,7 @@ static void test_update_ca(void)
ASSERT_GT(skel->bss->ca2_cnt, 0, "ca2_ca2_cnt");
bpf_link__destroy(link);
out:
tcp_ca_update__destroy(skel);
}
......@@ -447,7 +449,8 @@ static void test_update_wrong(void)
return;
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
ASSERT_OK_PTR(link, "attach_struct_ops");
if (!ASSERT_OK_PTR(link, "attach_struct_ops"))
goto out;
do_test(&opts);
saved_ca1_cnt = skel->bss->ca1_cnt;
......@@ -460,6 +463,7 @@ static void test_update_wrong(void)
ASSERT_GT(skel->bss->ca1_cnt, saved_ca1_cnt, "ca2_ca1_cnt");
bpf_link__destroy(link);
out:
tcp_ca_update__destroy(skel);
}
......@@ -481,7 +485,8 @@ static void test_mixed_links(void)
return;
link_nl = bpf_map__attach_struct_ops(skel->maps.ca_no_link);
ASSERT_OK_PTR(link_nl, "attach_struct_ops_nl");
if (!ASSERT_OK_PTR(link_nl, "attach_struct_ops_nl"))
goto out;
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
ASSERT_OK_PTR(link, "attach_struct_ops");
......@@ -494,6 +499,7 @@ static void test_mixed_links(void)
bpf_link__destroy(link);
bpf_link__destroy(link_nl);
out:
tcp_ca_update__destroy(skel);
}
......@@ -536,7 +542,8 @@ static void test_link_replace(void)
bpf_link__destroy(link);
link = bpf_map__attach_struct_ops(skel->maps.ca_update_2);
ASSERT_OK_PTR(link, "attach_struct_ops_2nd");
if (!ASSERT_OK_PTR(link, "attach_struct_ops_2nd"))
goto out;
/* BPF_F_REPLACE with a wrong old map Fd. It should fail!
*
......@@ -559,6 +566,7 @@ static void test_link_replace(void)
bpf_link__destroy(link);
out:
tcp_ca_update__destroy(skel);
}
......
......@@ -222,7 +222,7 @@ static void test_xdp_adjust_frags_tail_grow(void)
prog = bpf_object__next_program(obj, NULL);
if (bpf_object__load(obj))
return;
goto out;
prog_fd = bpf_program__fd(prog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment