aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-02-15 16:36:21 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-17 18:46:58 -0500
commit2c4cc9712364c051b1de2d175d5fbea6be948ebf (patch)
tree26a96c9f5c6762780a5941fddcb326eb8a555449 /net/ipv4/tcp_ipv4.c
parent04c03114be82194d4a4858d41dba8e286ad1787c (diff)
tcp: tcp_v4_err() should be more careful
ICMP handlers are not very often stressed, we should make them more resilient to bugs that might surface in the future. If there is no packet in retransmit queue, we should avoid a NULL deref. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: soukjin bae <soukjin.bae@samsung.com> Acked-by: Neal Cardwell <ncardwell@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index efc6fef692ff..ec3cea9d6828 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -536,12 +536,15 @@ int tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
536 if (sock_owned_by_user(sk)) 536 if (sock_owned_by_user(sk))
537 break; 537 break;
538 538
539 skb = tcp_rtx_queue_head(sk);
540 if (WARN_ON_ONCE(!skb))
541 break;
542
539 icsk->icsk_backoff--; 543 icsk->icsk_backoff--;
540 icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) : 544 icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) :
541 TCP_TIMEOUT_INIT; 545 TCP_TIMEOUT_INIT;
542 icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX); 546 icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX);
543 547
544 skb = tcp_rtx_queue_head(sk);
545 548
546 tcp_mstamp_refresh(tp); 549 tcp_mstamp_refresh(tp);
547 delta_us = (u32)(tp->tcp_mstamp - tcp_skb_timestamp_us(skb)); 550 delta_us = (u32)(tp->tcp_mstamp - tcp_skb_timestamp_us(skb));