Skip to content

Commit 04c0311

Browse files
edumazetdavem330
authored andcommitted
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>
1 parent e928b5d commit 04c0311

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2528,6 +2528,7 @@ void tcp_write_queue_purge(struct sock *sk)
25282528
sk_mem_reclaim(sk);
25292529
tcp_clear_all_retrans_hints(tcp_sk(sk));
25302530
tcp_sk(sk)->packets_out = 0;
2531+
inet_csk(sk)->icsk_backoff = 0;
25312532
}
25322533

25332534
int tcp_disconnect(struct sock *sk, int flags)
@@ -2576,7 +2577,6 @@ int tcp_disconnect(struct sock *sk, int flags)
25762577
tp->write_seq += tp->max_window + 2;
25772578
if (tp->write_seq == 0)
25782579
tp->write_seq = 1;
2579-
icsk->icsk_backoff = 0;
25802580
tp->snd_cwnd = 2;
25812581
icsk->icsk_probes_out = 0;
25822582
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;

0 commit comments

Comments
 (0)