tcp: do not accept packets beyond window
authorEric Dumazet <edumazet@google.com>
Fri, 11 Jul 2025 11:39:59 +0000 (11:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Jul 2025 01:41:15 +0000 (18:41 -0700)
commit9ca48d616ed76b284f946667a3cb7961205c8ee3
tree4b4e15fe1c9df854a449b7762b868d932c046320
parenta86eb2a60dcc2e23d86d24272d474f0ddecc824e
tcp: do not accept packets beyond window

Currently, TCP accepts incoming packets which might go beyond the
offered RWIN.

Add to tcp_sequence() the validation of packet end sequence.

Add the corresponding check in the fast path.

We relax this new constraint if the receive queue is empty,
to not freeze flows from buggy peers.

Add a new drop reason : SKB_DROP_REASON_TCP_INVALID_END_SEQUENCE.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250711114006.480026-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/dropreason-core.h
net/ipv4/tcp_input.c