From: Qingshuang Fu <fffsqian@163.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
SeongJae Park <sjpark@amazon.de>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Qingshuang Fu <fuqingshuang@kylinos.cn>,
Qingshuang Fu <fffsqian@163.com>
Subject: [PATCH net v2 2/2] selftests/net: check fork() return value in fin_ack_lat
Date: Fri, 21 Aug 2026 11:14:42 +0800 [thread overview]
Message-ID: <20260821031442.1124777-2-fffsqian@163.com> (raw)
In-Reply-To: <20260821031442.1124777-1-fffsqian@163.com>
From: Qingshuang Fu <fuqingshuang@kylinos.cn>
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.
Fixes: af8c8a450bf4 ("selftests: net: Add FIN_ACK processing order related latency spike test")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
---
tools/testing/selftests/net/fin_ack_lat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/fin_ack_lat.c b/tools/testing/selftests/net/fin_ack_lat.c
index 98044e6f9f43..4068f8e227cf 100644
--- a/tools/testing/selftests/net/fin_ack_lat.c
+++ b/tools/testing/selftests/net/fin_ack_lat.c
@@ -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
--
2.25.1
next prev parent reply other threads:[~2026-08-21 3:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 3:09 [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat Qingshuang Fu
2026-08-21 3:14 ` Qingshuang Fu [this message]
2026-08-21 6:45 ` [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821031442.1124777-2-fffsqian@163.com \
--to=fffsqian@163.com \
--cc=apw@canonical.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fuqingshuang@kylinos.cn \
--cc=horms@kernel.org \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=sjpark@amazon.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox