Skip to content

Commit fa141e9

Browse files
bastien-curutchetKernel Patches Daemon
authored andcommitted
selftests/bpf: test_xsk: Release resources when swap fails
testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 1f172de commit fa141e9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/selftests/bpf/test_xsk.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,8 +1873,13 @@ int testapp_xdp_prog_cleanup(struct test_spec *test)
18731873
if (testapp_validate_traffic(test))
18741874
return TEST_FAILURE;
18751875

1876-
if (swap_xsk_resources(test))
1876+
if (swap_xsk_resources(test)) {
1877+
clean_sockets(test, test->ifobj_rx);
1878+
clean_sockets(test, test->ifobj_tx);
1879+
clean_umem(test, test->ifobj_rx, test->ifobj_tx);
18771880
return TEST_FAILURE;
1881+
}
1882+
18781883
return testapp_validate_traffic(test);
18791884
}
18801885

0 commit comments

Comments
 (0)