]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tcp: clear icsk_backoff in tcp_write_queue_purge()
authorEric Dumazet <edumazet@google.com>
Fri, 15 Feb 2019 21:36:20 +0000 (13:36 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Feb 2019 08:04:25 +0000 (09:04 +0100)
[ Upstream commit 04c03114be82194d4a4858d41dba8e286ad1787c ]

soukjin bae reported a crash in tcp_v4_err() handling
ICMP_DEST_UNREACH after tcp_write_queue_head(sk)
returned a NULL pointer.

Current logic should have prevented this :

  if (seq != tp->snd_una  || !icsk->icsk_retransmits ||
      !icsk->icsk_backoff || fastopen)
      break;

Problem is the write queue might have been purged
and icsk_backoff has not been cleared.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: soukjin bae <soukjin.bae@samsung.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/tcp.h
net/ipv4/tcp.c

index bca27ae031e2a2ad7c4853b9fa409963f642403d..3eb375704dd70665ac1f828086b8031ca6744f2a 100644 (file)
@@ -1379,6 +1379,7 @@ static inline void tcp_write_queue_purge(struct sock *sk)
                sk_wmem_free_skb(sk, skb);
        sk_mem_reclaim(sk);
        tcp_clear_all_retrans_hints(tcp_sk(sk));
+       inet_csk(sk)->icsk_backoff = 0;
 }
 
 static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk)
index e2a545f3db6870098a7949014ae3fe8750c9c34d..eb6b60691330de49be8b68cec606719cc0d62c1f 100644 (file)
@@ -2258,7 +2258,6 @@ int tcp_disconnect(struct sock *sk, int flags)
        tp->srtt_us = 0;
        if ((tp->write_seq += tp->max_window + 2) == 0)
                tp->write_seq = 1;
-       icsk->icsk_backoff = 0;
        tp->snd_cwnd = 2;
        icsk->icsk_probes_out = 0;
        tp->packets_out = 0;