Commit 838eb968 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski
Browse files

tcp: tcp_tx_timestamp() must look at the rtx queue



tcp_tx_timestamp() is only called at the end of tcp_sendmsg_locked()
before the final tcp_push().

By the time it is called, it is possible all the copied data
has been sent already (transmit queue is empty).

If this is the case, use the last skb in the rtx queue.

Fixes: 75c119af ("tcp: implement rb-tree based retransmit queue")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarJason Xing <kerneljasonxing@gmail.com>
Link: https://patch.msgid.link/20260127123828.4098577-2-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5b71de34
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -501,6 +501,9 @@ static void tcp_tx_timestamp(struct sock *sk, struct sockcm_cookie *sockc)
	struct sk_buff *skb = tcp_write_queue_tail(sk);
	u32 tsflags = sockc->tsflags;

	if (unlikely(!skb))
		skb = skb_rb_last(&sk->tcp_rtx_queue);

	if (tsflags && skb) {
		struct skb_shared_info *shinfo = skb_shinfo(skb);
		struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);