tcp: exit if nothing to retransmit on RTO timeout
authorYuchung Cheng <[email protected]>
Wed, 16 Jan 2019 23:05:28 +0000 (15:05 -0800)
committerDavid S. Miller <[email protected]>
Thu, 17 Jan 2019 23:12:26 +0000 (15:12 -0800)
Previously TCP only warns if its RTO timer fires and the
retransmission queue is empty, but it'll cause null pointer
reference later on. It's better to avoid such catastrophic failure
and simply exit with a warning.

Signed-off-by: Yuchung Cheng <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Neal Cardwell <[email protected]>
Reviewed-by: Soheil Hassas Yeganeh <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/ipv4/tcp_timer.c

index 71a29e9c06206f3826296515d81ab5c010d222e7..e7d09e3705b8afdefd48216071533f9f8ac9a36f 100644 (file)
@@ -443,10 +443,8 @@ void tcp_retransmit_timer(struct sock *sk)
                 */
                return;
        }
-       if (!tp->packets_out)
-               goto out;
-
-       WARN_ON(tcp_rtx_queue_empty(sk));
+       if (!tp->packets_out || WARN_ON_ONCE(tcp_rtx_queue_empty(sk)))
+               return;
 
        tp->tlp_high_seq = 0;