linux-stable/net/ipv4
xin.guo f5a27666c8 tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range
[ Upstream commit a041f70e57 ]

If the new coming segment covers more than one skbs in the ofo queue,
and which seq is equal to rcv_nxt, then the sequence range
that is duplicated will be sent as DUP SACK, the detail as below,
in step6, the {501,2001} range is clearly including too much
DUP SACK range, in violation of RFC 2883 rules.

1. client > server: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500
2. server > client: Flags [.], ack 1, [nop,nop,sack 1 {501:1001}], length 0
3. client > server: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500
4. server > client: Flags [.], ack 1, [nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client > server: Flags [.], seq 1:2001, ack 1325288529, win 20000, length 2000
6. server > client: Flags [.], ack 2001, [nop,nop,sack 1 {501:2001}], length 0

After this fix, the final ACK is as below:

6. server > client: Flags [.], ack 2001, options [nop,nop,sack 1 {501:1001}], length 0

[edumazet] added a new packetdrill test in the following patch.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: xin.guo <guoxin0309@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250626123420.1933835-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:07 +02:00
..
bpfilter
netfilter netfilter: fib: check correct rtable in vrf setups 2024-10-17 15:11:57 +02:00
af_inet.c net: inet: do not leave a dangling sk pointer in inet_create() 2024-12-14 19:51:37 +01:00
ah4.c
arp.c arp: switch to dev_getbyhwaddr() in arp_req_set_public() 2025-03-13 12:50:53 +01:00
bpf_tcp_ca.c
cipso_ipv4.c cipso: fix total option length computation 2024-07-05 09:14:29 +02:00
datagram.c
devinet.c ipv4: use RCU protection in inet_select_addr() 2025-03-13 12:50:42 +01:00
esp4_offload.c
esp4.c net: esp: cleanup esp_output_tail_tcp() in case of unsupported ESPINTCP 2024-08-19 05:44:55 +02:00
fib_frontend.c ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). 2025-06-04 14:37:59 +02:00
fib_lookup.h
fib_notifier.c
fib_rules.c ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). 2025-06-04 14:38:03 +02:00
fib_semantics.c net: Add l3mdev index to flow struct and avoid oif reset for port devices 2024-10-17 15:11:57 +02:00
fib_trie.c ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). 2025-06-04 14:37:59 +02:00
fou.c fou: remove warn in gue_gro_receive on unsupported protocol 2024-12-14 19:51:46 +01:00
gre_demux.c
gre_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_complete handlers 2024-09-12 11:07:47 +02:00
icmp.c
igmp.c
inet_connection_sock.c tcp: Fix use-after-free of nreq in reqsk_timer_handler(). 2024-12-14 19:51:10 +01:00
inet_diag.c inet_diag: Initialize pad field in struct inet_diag_req_v2 2024-07-18 13:07:31 +02:00
inet_fragment.c inet: inet_defrag: prevent sk release while still in use 2024-10-17 15:10:41 +02:00
inet_hashtables.c tcp: bring back NUMA dispersion in inet_ehash_locks_alloc() 2025-06-04 14:37:58 +02:00
inet_timewait_sock.c
inetpeer.c
ip_forward.c
ip_fragment.c inet: inet_defrag: prevent sk release while still in use 2024-10-17 15:10:41 +02:00
ip_gre.c net: Handle l3mdev in ip_tunnel_init_flow 2024-10-17 15:12:01 +02:00
ip_input.c
ip_options.c
ip_output.c
ip_sockglue.c
ip_tunnel_core.c net: fix geneve_opt length integer overflow 2025-04-10 14:32:05 +02:00
ip_tunnel.c ipv4: ip_tunnel: Fix suspicious RCU usage warning in ip_tunnel_find() 2025-02-01 18:24:01 +01:00
ip_vti.c
ipcomp.c
ipconfig.c
ipip.c
ipmr_base.c ipmr: do not call mr_mfc_uses_dev() for unres entries 2025-03-13 12:50:11 +01:00
ipmr.c
Kconfig
Makefile
metrics.c
netfilter.c
netlink.c
nexthop.c net: nexthop: Initialize all fields in dumped nexthops 2024-08-19 05:45:24 +02:00
ping.c
proc.c
protocol.c
raw_diag.c
raw.c net: drop nopreempt requirement on sock_prot_inuse_add() 2024-07-05 09:14:08 +02:00
route.c ipv4/route: Use this_cpu_inc() for stats on PREEMPT_RT 2025-06-27 11:05:31 +01:00
syncookies.c
sysctl_net_ipv4.c
tcp_bbr.c
tcp_bic.c
tcp_bpf.c tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection 2025-01-09 13:28:37 +01:00
tcp_cdg.c
tcp_cong.c
tcp_cubic.c tcp_cubic: fix incorrect HyStart round start detection 2025-03-13 12:49:59 +01:00
tcp_dctcp.c tcp: Fix shift-out-of-bounds in dctcp_update_alpha(). 2024-06-16 13:39:47 +02:00
tcp_dctcp.h
tcp_diag.c
tcp_fastopen.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range 2025-08-28 16:24:07 +02:00
tcp_ipv4.c tcp: avoid reusing FIN_WAIT2 when trying to find port in connect() process 2024-10-17 15:11:26 +02:00
tcp_lp.c
tcp_metrics.c tcp_metrics: validate source addr length 2024-07-18 13:07:30 +02:00
tcp_minisocks.c tcp: Defer ts_recent changes until req is owned 2025-03-13 12:50:57 +01:00
tcp_nv.c
tcp_offload.c net-timestamp: support TCP GSO case for a few missing flags 2025-03-13 12:51:07 +01:00
tcp_output.c tcp: check space before adding MPTCP SYN options 2024-12-19 18:07:16 +01:00
tcp_rate.c
tcp_recovery.c
tcp_scalable.c
tcp_timer.c tcp: fix race in tcp_write_err() 2024-08-19 05:44:56 +02:00
tcp_ulp.c
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tcp.c tcp: fix races in tcp_abort() 2025-04-10 14:31:52 +02:00
tunnel4.c
udp_bpf.c
udp_diag.c
udp_impl.h
udp_offload.c net: ipv6: fix UDPv6 GSO segmentation with NAT 2025-05-09 09:39:39 +02:00
udp_tunnel_core.c
udp_tunnel_nic.c
udp_tunnel_stub.c
udp.c udp: gso: do not drop small packets when PMTU reduces 2025-03-13 12:50:22 +01:00
udplite.c
xfrm4_input.c
xfrm4_output.c
xfrm4_policy.c xfrm: respect ip protocols rules criteria when performing dst lookups 2024-11-01 01:52:36 +01:00
xfrm4_protocol.c
xfrm4_state.c
xfrm4_tunnel.c