Patch "tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()" has been added to the 6.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tcp-use-signed-arithmetic-in-tcp_rtx_probe0_timed_ou.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 58cc7354027b8f7421d84fab37dbd32bdbd0bf69
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Fri Jun 7 12:56:52 2024 +0000

    tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
    
    [ Upstream commit 36534d3c54537bf098224a32dc31397793d4594d ]
    
    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: e89688e3e978 ("net: tcp: fix unexcepted socket die when snd_wnd is 0")
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Cc: Menglong Dong <imagedong@xxxxxxxxxxx>
    Acked-by: Neal Cardwell <ncardwell@xxxxxxxxxx>
    Reviewed-by: Jason Xing <kerneljasonxing@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240607125652.1472540-1-edumazet@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index d1ad20ce1c8c7..f96f68cf7961c 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -483,8 +483,12 @@ static bool tcp_rtx_probe0_timed_out(const struct sock *sk,
 {
 	const struct tcp_sock *tp = tcp_sk(sk);
 	const int timeout = TCP_RTO_MAX * 2;
-	u32 rcv_delta;
+	s32 rcv_delta;
 
+	/* Note: timer interrupt might have been delayed by at least one jiffy,
+	 * and tp->rcv_tstamp might very well have been written recently.
+	 * rcv_delta can thus be negative.
+	 */
 	rcv_delta = inet_csk(sk)->icsk_timeout - tp->rcv_tstamp;
 	if (rcv_delta <= timeout)
 		return false;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux