summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2018-12-05 17:38:38 -0500
committerDavid S. Miller <davem@davemloft.net>2018-12-05 19:34:40 -0500
commitb2b7af861122a0c0f6260155c29a1b2e594cd5b5 (patch)
treee50108978bd22380b6d831725c8998bdd2a797d7 /net
parent41727549de3e7281feb174d568c6e46823db8684 (diff)
tcp: fix NULL ref in tail loss probe
TCP loss probe timer may fire when the retranmission queue is empty but has a non-zero tp->packets_out counter. tcp_send_loss_probe will call tcp_rearm_rto which triggers NULL pointer reference by fetching the retranmission queue head in its sub-routines. Add a more detailed warning to help catch the root cause of the inflight accounting inconsistency. Reported-by: Rafael Tinoco <rafael.tinoco@linaro.org> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_output.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 318690234758..5aa600900695 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2497,15 +2497,18 @@ void tcp_send_loss_probe(struct sock *sk)
2497 goto rearm_timer; 2497 goto rearm_timer;
2498 } 2498 }
2499 skb = skb_rb_last(&sk->tcp_rtx_queue); 2499 skb = skb_rb_last(&sk->tcp_rtx_queue);
2500 if (unlikely(!skb)) {
2501 WARN_ONCE(tp->packets_out,
2502 "invalid inflight: %u state %u cwnd %u mss %d\n",
2503 tp->packets_out, sk->sk_state, tp->snd_cwnd, mss);
2504 inet_csk(sk)->icsk_pending = 0;
2505 return;
2506 }
2500 2507
2501 /* At most one outstanding TLP retransmission. */ 2508 /* At most one outstanding TLP retransmission. */
2502 if (tp->tlp_high_seq) 2509 if (tp->tlp_high_seq)
2503 goto rearm_timer; 2510 goto rearm_timer;
2504 2511
2505 /* Retransmit last segment. */
2506 if (WARN_ON(!skb))
2507 goto rearm_timer;
2508
2509 if (skb_still_in_host_queue(sk, skb)) 2512 if (skb_still_in_host_queue(sk, skb))
2510 goto rearm_timer; 2513 goto rearm_timer;
2511 2514