| From 3ecf52ac5fee37cc3aa799b1d806f8ac8ad6dd93 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Tue, 27 Jan 2026 12:38:27 +0000 |
| Subject: tcp: tcp_tx_timestamp() must look at the rtx queue |
| |
| From: Eric Dumazet <edumazet@google.com> |
| |
| [ Upstream commit 838eb9687691d29915797a885b861fd09353386e ] |
| |
| 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: 75c119afe14f ("tcp: implement rb-tree based retransmit queue") |
| Signed-off-by: Eric Dumazet <edumazet@google.com> |
| Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> |
| Link: https://patch.msgid.link/20260127123828.4098577-2-edumazet@google.com |
| Signed-off-by: Jakub Kicinski <kuba@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| net/ipv4/tcp.c | 3 +++ |
| 1 file changed, 3 insertions(+) |
| |
| diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
| index b3d373372e841..36981a3e9013f 100644 |
| --- a/net/ipv4/tcp.c |
| +++ b/net/ipv4/tcp.c |
| @@ -471,6 +471,9 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags) |
| { |
| struct sk_buff *skb = tcp_write_queue_tail(sk); |
| |
| + 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); |
| -- |
| 2.51.0 |
| |