Skip to content

Commit 0dde0c4

Browse files
committed
tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.22.1.rt7.363.el8_10 commit-author Eric Dumazet <edumazet@google.com> commit 36534d3 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-rt-4.18.0-553.22.1.rt7.363.el8_10/36534d3c.failed Due to timer wheel implementation, a timer will usually fire after its schedule. For instance, for HZ=1000, a timeout between 512ms and 4s has a granularity of 64ms. For this range of values, the extra delay could be up to 63ms. For TCP, this means that tp->rcv_tstamp may be after inet_csk(sk)->icsk_timeout whenever the timer interrupt finally triggers, if one packet came during the extra delay. We need to make sure tcp_rtx_probe0_timed_out() handles this case. Fixes: e89688e ("net: tcp: fix unexcepted socket die when snd_wnd is 0") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Menglong Dong <imagedong@tencent.com> Acked-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Link: https://lore.kernel.org/r/20240607125652.1472540-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 36534d3) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # net/ipv4/tcp_timer.c
1 parent c16f949 commit 0dde0c4

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
2+
3+
jira LE-3201
4+
Rebuild_History Non-Buildable kernel-rt-4.18.0-553.22.1.rt7.363.el8_10
5+
commit-author Eric Dumazet <edumazet@google.com>
6+
commit 36534d3c54537bf098224a32dc31397793d4594d
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-rt-4.18.0-553.22.1.rt7.363.el8_10/36534d3c.failed
10+
11+
Due to timer wheel implementation, a timer will usually fire
12+
after its schedule.
13+
14+
For instance, for HZ=1000, a timeout between 512ms and 4s
15+
has a granularity of 64ms.
16+
For this range of values, the extra delay could be up to 63ms.
17+
18+
For TCP, this means that tp->rcv_tstamp may be after
19+
inet_csk(sk)->icsk_timeout whenever the timer interrupt
20+
finally triggers, if one packet came during the extra delay.
21+
22+
We need to make sure tcp_rtx_probe0_timed_out() handles this case.
23+
24+
Fixes: e89688e3e978 ("net: tcp: fix unexcepted socket die when snd_wnd is 0")
25+
Signed-off-by: Eric Dumazet <edumazet@google.com>
26+
Cc: Menglong Dong <imagedong@tencent.com>
27+
Acked-by: Neal Cardwell <ncardwell@google.com>
28+
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
29+
Link: https://lore.kernel.org/r/20240607125652.1472540-1-edumazet@google.com
30+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31+
(cherry picked from commit 36534d3c54537bf098224a32dc31397793d4594d)
32+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
33+
34+
# Conflicts:
35+
# net/ipv4/tcp_timer.c
36+
diff --cc net/ipv4/tcp_timer.c
37+
index c8ceb32ca8de,5bfd76a31af6..000000000000
38+
--- a/net/ipv4/tcp_timer.c
39+
+++ b/net/ipv4/tcp_timer.c
40+
@@@ -424,8 -485,12 +424,16 @@@ static bool tcp_rtx_probe0_timed_out(co
41+
{
42+
const struct tcp_sock *tp = tcp_sk(sk);
43+
const int timeout = TCP_RTO_MAX * 2;
44+
++<<<<<<< HEAD
45+
+ u32 rcv_delta, rtx_delta;
46+
++=======
47+
+ s32 rcv_delta;
48+
++>>>>>>> 36534d3c5453 (tcp: use signed arithmetic in tcp_rtx_probe0_timed_out())
49+
50+
+ /* Note: timer interrupt might have been delayed by at least one jiffy,
51+
+ * and tp->rcv_tstamp might very well have been written recently.
52+
+ * rcv_delta can thus be negative.
53+
+ */
54+
rcv_delta = inet_csk(sk)->icsk_timeout - tp->rcv_tstamp;
55+
if (rcv_delta <= timeout)
56+
return false;
57+
* Unmerged path net/ipv4/tcp_timer.c

0 commit comments

Comments
 (0)