Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cebce36 authored by Yuchung Cheng's avatar Yuchung Cheng Committed by David S. Miller
Browse files

tcp: fix infinite cwnd in tcp_complete_cwr()



When the cwnd reduction is done, ssthresh may be infinite
if TCP enters CWR via ECN or F-RTO. If cwnd is not undone, i.e.,
undo_marker is set, tcp_complete_cwr() falsely set cwnd to the
infinite ssthresh value. The correct operation is to keep cwnd
intact because it has been updated in ECN or F-RTO.

Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05be1824
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2868,12 +2868,15 @@ static inline void tcp_complete_cwr(struct sock *sk)

	/* Do not moderate cwnd if it's already undone in cwr or recovery. */
	if (tp->undo_marker) {
		if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR)
		if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) {
			tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
		else /* PRR */
			tp->snd_cwnd_stamp = tcp_time_stamp;
		} else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) {
			/* PRR algorithm. */
			tp->snd_cwnd = tp->snd_ssthresh;
			tp->snd_cwnd_stamp = tcp_time_stamp;
		}
	}
	tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR);
}