Commit 4f381ea4 authored by Eric Dumazet's avatar Eric Dumazet Committed by Stefan Bader

tcp: clear icsk_backoff in tcp_write_queue_purge()

BugLink: https://bugs.launchpad.net/bugs/1818815

[ Upstream commit 04c03114 ]

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: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarsoukjin bae <soukjin.bae@samsung.com>
Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 315bc349
...@@ -1457,6 +1457,7 @@ static inline void tcp_write_queue_purge(struct sock *sk) ...@@ -1457,6 +1457,7 @@ static inline void tcp_write_queue_purge(struct sock *sk)
sk_wmem_free_skb(sk, skb); sk_wmem_free_skb(sk, skb);
sk_mem_reclaim(sk); sk_mem_reclaim(sk);
tcp_clear_all_retrans_hints(tcp_sk(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) static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk)
......
...@@ -2253,7 +2253,6 @@ int tcp_disconnect(struct sock *sk, int flags) ...@@ -2253,7 +2253,6 @@ int tcp_disconnect(struct sock *sk, int flags)
tp->write_seq += tp->max_window + 2; tp->write_seq += tp->max_window + 2;
if (tp->write_seq == 0) if (tp->write_seq == 0)
tp->write_seq = 1; tp->write_seq = 1;
icsk->icsk_backoff = 0;
tp->snd_cwnd = 2; tp->snd_cwnd = 2;
icsk->icsk_probes_out = 0; icsk->icsk_probes_out = 0;
tp->packets_out = 0; tp->packets_out = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment