Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: make probe0 timer handle expired user timeout

tcp_clamp_probe0_to_user_timeout() computes remaining time in jiffies
using subtraction with an unsigned lvalue. If elapsed probing time
exceeds the configured TCP_USER_TIMEOUT, the underflow yields a large
value.

This ends up re-arming the probe timer for a full backoff interval
instead of expiring immediately, delaying connection teardown beyond
the configured timeout.

Fix this by preventing underflow so user-set timeout expiration is
handled correctly without extending the probe timer.

Fixes: 344db93ae3ee ("tcp: make TCP_USER_TIMEOUT accurate for zero window probes")
Link: https://lore.kernel.org/r/20260414013634.43997-1-ahacigu.linux@gmail.com
Signed-off-by: Altan Hacigumus <ahacigu.linux@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260424014639.54110-1-ahacigu.linux@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Altan Hacigumus and committed by
Jakub Kicinski
2b9f6f70 cc427d24

+3 -2
+3 -2
net/ipv4/tcp_timer.c
··· 50 50 u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when) 51 51 { 52 52 const struct inet_connection_sock *icsk = inet_csk(sk); 53 - u32 remaining, user_timeout; 53 + u32 user_timeout; 54 + s32 remaining; 54 55 s32 elapsed; 55 56 56 57 user_timeout = READ_ONCE(icsk->icsk_user_timeout); ··· 62 61 if (unlikely(elapsed < 0)) 63 62 elapsed = 0; 64 63 remaining = msecs_to_jiffies(user_timeout) - elapsed; 65 - remaining = max_t(u32, remaining, TCP_TIMEOUT_MIN); 64 + remaining = max_t(int, remaining, TCP_TIMEOUT_MIN); 66 65 67 66 return min_t(u32, remaining, when); 68 67 }