aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-02-15 16:36:20 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-17 18:46:58 -0500
commit04c03114be82194d4a4858d41dba8e286ad1787c (patch)
treefb25d7781f7faf8576f77965e3e586129da4b6aa
parente928b5d6b75e239feb9c6d5488974b6646a0ebc8 (diff)
tcp: clear icsk_backoff in tcp_write_queue_purge()
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>
-rw-r--r--net/ipv4/tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2079145a3b7c..cf3c5095c10e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2528,6 +2528,7 @@ void tcp_write_queue_purge(struct sock *sk)
2528 sk_mem_reclaim(sk); 2528 sk_mem_reclaim(sk);
2529 tcp_clear_all_retrans_hints(tcp_sk(sk)); 2529 tcp_clear_all_retrans_hints(tcp_sk(sk));
2530 tcp_sk(sk)->packets_out = 0; 2530 tcp_sk(sk)->packets_out = 0;
2531 inet_csk(sk)->icsk_backoff = 0;
2531} 2532}
2532 2533
2533int tcp_disconnect(struct sock *sk, int flags) 2534int tcp_disconnect(struct sock *sk, int flags)
@@ -2576,7 +2577,6 @@ int tcp_disconnect(struct sock *sk, int flags)
2576 tp->write_seq += tp->max_window + 2; 2577 tp->write_seq += tp->max_window + 2;
2577 if (tp->write_seq == 0) 2578 if (tp->write_seq == 0)
2578 tp->write_seq = 1; 2579 tp->write_seq = 1;
2579 icsk->icsk_backoff = 0;
2580 tp->snd_cwnd = 2; 2580 tp->snd_cwnd = 2;
2581 icsk->icsk_probes_out = 0; 2581 icsk->icsk_probes_out = 0;
2582 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; 2582 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;