]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tcp: fix icsk_ack.ato bitfield overflow
authorJiayuan Chen <jiayuan.chen@linux.dev>
Fri, 7 Aug 2026 01:44:36 +0000 (09:44 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 10 Aug 2026 23:02:30 +0000 (16:02 -0700)
commit60837e4b840a9c3f7ec826e3584df0bc6542a2c2
tree215a4ead671bf34e0c7d73aa84f12f086e0ce850
parent883b56ae58fe657d8497806c7059646e9ba6dbd0
tcp: fix icsk_ack.ato bitfield overflow

On cross-region connections we observed delayed ACKs suddenly turning
into immediate ACKs plus a TCP_MAX_QUICKACKS burst, as if the
connection had just received its first data segment.

Commit 95b9a87c6a6b ("tcp: record last received ipv6 flowlabel")
squeezed icsk_ack.ato into 8 bits, sized for TCP_DELACK_MAX. But both
writers still bound ato by icsk_rto, which can be well above 255
jiffies, so the bitfield assignment silently wraps mod 256: repeated
delack timer misses double ato up to icsk_rto, storing 320 as 64 and
256 as 0, and ato == 0 is the "first data packet" sentinel in
tcp_event_data_recv().

Clamp both writers to TCP_DELACK_MAX, which the static_assert already
guarantees to fit and tcp_send_delayed_ack() effectively caps ato at
anyway.

Fixes: 95b9a87c6a6b ("tcp: record last received ipv6 flowlabel")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Link: https://patch.msgid.link/20260807014437.36687-1-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_input.c
net/ipv4/tcp_timer.c