Commit d07980f7 authored by Ma Ke's avatar Ma Ke Committed by Andrii Nakryiko

selftests/bpf: Don't close(-1) in serial_test_fexit_stress()

Guard close() with extra link_fd[i] > 0 and fexit_fd[i] > 0
check to prevent close(-1).
Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240623131753.2133829-1-make24@iscas.ac.cn
parent aa293983
......@@ -50,9 +50,9 @@ void serial_test_fexit_stress(void)
out:
for (i = 0; i < bpf_max_tramp_links; i++) {
if (link_fd[i])
if (link_fd[i] > 0)
close(link_fd[i]);
if (fexit_fd[i])
if (fexit_fd[i] > 0)
close(fexit_fd[i]);
}
free(fd);
......
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