Thread (2 messages) 2 messages, 2 authors, 2026-01-05

[PATCH net-next] tcp: fix error handling of tcp_retransmit_skb

flat view
STALE285d

From: 刘聪聪(方勿) <hidden>
Date: 2026-01-05 17:52:58
Also in: lkml
Subsystem: networking [general], networking [tcp], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Neal Cardwell, Linus Torvalds

The tcp_retransmit_timer() function checks if tcp_retransmit_skb()
returns a value greater than 0, but tcp_retransmit_skb() returns
0 on success and negative error codes on failure. This means the
error handling branch is never executed when retransmission fails.

Fix this by changing the condition to check for != 0 instead of > 0.

Signed-off-by: Liu Congcong <redacted>
---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 160080c9021d..4fbb387e7e7b 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -624,7 +624,7 @@ void tcp_retransmit_timer(struct sock *sk)
 	tcp_enter_loss(sk);
 
 	tcp_update_rto_stats(sk);
-	if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) > 0) {
+	if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1)) {
 		/* Retransmission failed because of local congestion,
 		 * Let senders fight for local resources conservatively.
 		 */
-- 
2.17.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help