diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-18 10:51:48 -0500 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-11-19 14:47:59 +0100 |
| commit | f22d5042faa6b03df9586074e0322db60973933b (patch) | |
| tree | 1eb314d4a5aca948c1ba1cf50c90e41c13c4d828 /rust/kernel/alloc | |
| parent | 1b91d9c09aa703d19995412ad41f23b8886bc608 (diff) | |
tcp: clamp the samples in tcp_rcv_rtt_update()
tcp_rcv_rtt_update() starts with sample << 3 in u32 arithmetic, so a
sample of 536.9 s or more wraps.
tcp_rcv_rtt_measure() can hand it one. Its sample is the time the sender
took to fill one receive window, and a low rate flow can take longer
than that. This caller only looks for a minimum, so the wrapped value is
kept whenever it is below the current estimate. A 540 s sample ends up
as an estimate of about 3.1 s.
Clamp the sample to TCP_RTT_MAX_US in tcp_rcv_rtt_update(), like
tcp_rtt_estimator() does on the send side. That covers both callers, and
the smoothed estimate now tops out at 8 * 120 s, which fits in a u32.
Found by code inspection (Eric Dumazet), who also suggested the fix.
Confirmed with an LLM generated reproducer on an unmodified kernel, and
tested with the reproducer and existing kernel selftests.
Fixes: 645f4c6f2ebd ("tcp: switch rcv_rtt_est and rcvq_space to high resolution timestamps")
Suggested-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Chris Mason <mason@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261118155144.18393-5-mason@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
