Skip to content

Commit 025bb7f

Browse files
yuchungchenggregkh
authored andcommitted
tcp: avoid setting cwnd to invalid ssthresh after cwnd reduction states
[ Upstream commit ed254971edea92c3ac5c67c6a05247a92aa6075e ] If the sender switches the congestion control during ECN-triggered cwnd-reduction state (CA_CWR), upon exiting recovery cwnd is set to the ssthresh value calculated by the previous congestion control. If the previous congestion control is BBR that always keep ssthresh to TCP_INIFINITE_SSTHRESH, cwnd ends up being infinite. The safe step is to avoid assigning invalid ssthresh value when recovery ends. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2ab639c commit 025bb7f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,8 +2503,8 @@ static inline void tcp_end_cwnd_reduction(struct sock *sk)
25032503
struct tcp_sock *tp = tcp_sk(sk);
25042504

25052505
/* Reset cwnd to ssthresh in CWR or Recovery (unless it's undone) */
2506-
if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR ||
2507-
(tp->undo_marker && tp->snd_ssthresh < TCP_INFINITE_SSTHRESH)) {
2506+
if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH &&
2507+
(inet_csk(sk)->icsk_ca_state == TCP_CA_CWR || tp->undo_marker)) {
25082508
tp->snd_cwnd = tp->snd_ssthresh;
25092509
tp->snd_cwnd_stamp = tcp_time_stamp;
25102510
}

0 commit comments

Comments
 (0)