linux-stable/net
Fred Chen 3b5eb92c09 tcp: fix wrong RTO timeout when received SACK reneging
[ Upstream commit d2a0fc372a ]

This commit fix wrong RTO timeout when received SACK reneging.

When an ACK arrived pointing to a SACK reneging, tcp_check_sack_reneging()
will rearm the RTO timer for min(1/2*srtt, 10ms) into to the future.

But since the commit 62d9f1a694 ("tcp: fix TLP timer not set when
CA_STATE changes from DISORDER to OPEN") merged, the tcp_set_xmit_timer()
is moved after tcp_fastretrans_alert()(which do the SACK reneging check),
so the RTO timeout will be overwrited by tcp_set_xmit_timer() with
icsk_rto instead of 1/2*srtt.

Here is a packetdrill script to check this bug:
0     socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0    bind(3, ..., ...) = 0
+0    listen(3, 1) = 0

// simulate srtt to 100ms
+0    < S 0:0(0) win 32792 <mss 1000, sackOK,nop,nop,nop,wscale 7>
+0    > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
+.1    < . 1:1(0) ack 1 win 1024

+0    accept(3, ..., ...) = 4

+0    write(4, ..., 10000) = 10000
+0    > P. 1:10001(10000) ack 1

// inject sack
+.1    < . 1:1(0) ack 1 win 257 <sack 1001:10001,nop,nop>
+0    > . 1:1001(1000) ack 1

// inject sack reneging
+.1    < . 1:1(0) ack 1001 win 257 <sack 9001:10001,nop,nop>

// we expect rto fired in 1/2*srtt (50ms)
+.05    > . 1001:2001(1000) ack 1

This fix remove the FLAG_SET_XMIT_TIMER from ack_flag when
tcp_check_sack_reneging() set RTO timer with 1/2*srtt to avoid
being overwrited later.

Fixes: 62d9f1a694 ("tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN")
Signed-off-by: Fred Chen <fred.chenchen03@gmail.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Tested-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-08 11:21:06 +01:00
..
6lowpan
9p 9p: virtio: make sure 'offs' is initialized in zc_request 2023-09-23 10:46:52 +02:00
802 mrp: introduce active flags to prevent UAF when applicant uninit 2023-01-18 09:26:32 +01:00
8021q vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit() 2023-05-30 12:38:36 +01:00
appletalk
atm atm: hide unused procfs functions 2023-06-09 10:22:52 +02:00
ax25 ax25: Fix UAF bugs in ax25 timers 2022-04-27 13:15:32 +02:00
batman-adv batman-adv: Fix batadv_v_ogm_aggr_send memory leak 2023-08-30 16:35:15 +02:00
bluetooth Bluetooth: hci_event: Fix using memcmp when comparing keys 2023-10-25 11:13:33 +02:00
bpf bpf, test_run: Fix alignment problem in bpf_prog_test_run_skb() 2022-11-25 17:36:54 +01:00
bridge net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode 2023-08-11 11:33:40 +02:00
caif net: caif: Fix use-after-free in cfusbl_device_notify() 2023-03-17 08:30:37 +01:00
can can: bcm: Fix UAF in bcm_proc_show() 2023-08-11 11:33:47 +02:00
ceph libceph: fix potential hang in ceph_osdc_notify() 2023-08-11 11:33:56 +02:00
core rtnetlink: Reject negative ifindexes in RTM_NEWLINK 2023-10-10 21:43:42 +02:00
dcb net: dcb: disable softirqs in dcbnl_flush_dev() 2022-03-08 19:01:58 +01:00
dccp dccp: fix dccp_v4_err()/dccp_v6_err() again 2023-10-10 21:43:38 +02:00
decnet Remove DECnet support from kernel 2023-06-21 15:38:58 +02:00
dns_resolver
dsa
ethernet
hsr net: hsr: Fix potential use-after-free 2022-12-08 11:16:32 +01:00
ieee802154 net: ieee802154: fix error return code in dgram_bind() 2022-11-03 23:50:54 +09:00
ife
ipv4 tcp: fix wrong RTO timeout when received SACK reneging 2023-11-08 11:21:06 +01:00
ipv6 net: ipv6: fix return value check in esp_remove_trailer 2023-10-25 11:13:32 +02:00
ipx
iucv net/iucv: Fix size of interrupt data 2023-03-22 13:26:15 +01:00
kcm kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg(). 2023-09-23 10:47:03 +02:00
key net: af_key: fix sadb_x_filter validation 2023-08-30 16:35:11 +02:00
l2tp ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data() 2023-10-10 21:43:41 +02:00
l3mdev
lapb
llc llc: Don't drop packet from non-root netns. 2023-08-11 11:33:49 +02:00
mac80211 wifi: mac80211: allow transmitting EAPOL frames with tainted key 2023-10-25 11:13:32 +02:00
mac802154 mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add() 2022-12-14 11:26:14 +01:00
mpls net: mpls: fix stale pointer if allocation fails during device rename 2023-02-22 12:46:06 +01:00
ncsi net/ncsi: Avoid GFP_KERNEL in response handler 2021-04-16 11:57:51 +02:00
netfilter netfilter: nft_payload: fix wrong mac header matching 2023-10-25 11:13:31 +02:00
netlabel netlabel: fix shift wrapping bug in netlbl_catmap_setlong() 2023-09-23 10:46:53 +02:00
netlink netlink: Add __sock_i_ino() for __netlink_diag_dump(). 2023-08-11 11:33:35 +02:00
netrom netrom: Deny concurrent connect(). 2023-09-23 10:46:55 +02:00
nfc nfc: nci: fix possible NULL pointer dereference in send_acknowledge() 2023-10-25 11:13:31 +02:00
nsh net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment() 2023-05-30 12:38:36 +01:00
openvswitch net: openvswitch: fix flow memory leak in ovs_flow_cmd_new 2023-02-22 12:46:01 +01:00
packet net/packet: annotate data-races around tp->status 2023-08-16 18:10:54 +02:00
phonet phonet: refcount leak in pep_sock_accep 2022-01-11 13:57:37 +01:00
psample
qrtr
rds net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks() 2022-10-26 13:17:00 +02:00
rfkill net: rfkill: gpio: prevent value glitch during probe 2023-10-25 11:13:32 +02:00
rose net/rose: Fix to not accept on connected socket 2023-02-22 12:46:05 +01:00
rxrpc rxrpc: Don't try to resend the request if we're receiving the reply 2022-06-14 16:53:50 +02:00
sched net/sched: sch_hfsc: Ensure inner classes have fsc curve 2023-10-10 21:43:40 +02:00
sctp sctp: update hb timer immediately after users change hb_interval 2023-10-10 21:43:41 +02:00
smc net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending 2022-05-18 09:18:06 +02:00
strparser
sunrpc SUNRPC: Fix UAF in svc_tcp_listen_data_ready() 2023-08-11 11:33:44 +02:00
switchdev
tipc net: tipc: resize nlattr array to correct size 2023-06-21 15:38:59 +02:00
tls
unix af_unix: Fix data-race around unix_tot_inflight. 2023-09-23 10:47:02 +02:00
vmw_vsock vsock: avoid to close connected socket after the timeout 2023-05-30 12:38:36 +01:00
wimax
wireless wifi: cfg80211: avoid leaking stack data into trace 2023-10-25 11:13:32 +02:00
x25 net/x25: Fix to not accept on connected socket 2023-02-22 12:46:02 +01:00
xfrm xfrm: fix a data-race in xfrm_gen_index() 2023-10-25 11:13:31 +02:00
Kconfig Remove DECnet support from kernel 2023-06-21 15:38:58 +02:00
Makefile Remove DECnet support from kernel 2023-06-21 15:38:58 +02:00
compat.c net: Return the correct errno code 2021-06-30 08:48:47 -04:00
socket.c net: annotate sk->sk_err write from do_recvmmsg() 2023-05-30 12:38:34 +01:00
sysctl_net.c