selftests/net: check fork() return value in fin_ack_lat
authorQingshuang Fu <fuqingshuang@kylinos.cn>
Fri, 21 Aug 2026 03:14:42 +0000 (11:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 24 Aug 2026 18:40:29 +0000 (11:40 -0700)
main() never checks fork() for failure.  When fork() returns -1
(EAGAIN/ENOMEM/RLIMIT_NPROC), the !child_pid test is false and the
process falls into server()'s infinite accept() loop with no client ever
connecting, producing empty output.  The wrapper script treats an
empty log as a passing test, producing a false positive.

Check fork() for failure with error(), as is done for every other
syscall in this file.

Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260821031442.1124777-2-fffsqian@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/fin_ack_lat.c

index 98044e6..4068f8e 100644 (file)
@@ -143,6 +143,8 @@ int main(int argc, char const *argv[])
 
        fprintf(stderr, "server port: %d\n", ntohs(laddr.sin_port));
        child_pid = fork();
+       if (child_pid < 0)
+               error(-1, errno, "fork");
        if (!child_pid)
                client(ntohs(laddr.sin_port));
        else