[Midnightbsd-cvs] src [9317] trunk/sys/netinet/tcp_input.c: Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited"

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Mar 2 19:15:29 EST 2017


Revision: 9317
          http://svnweb.midnightbsd.org/src/?rev=9317
Author:   laffer1
Date:     2017-03-02 19:15:28 -0500 (Thu, 02 Mar 2017)
Log Message:
-----------
Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited"
logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and could
therefore potentially corrupt the result (although under normal operation,
neither variable should legitmately exceed 32 bits).

[1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html

Obtained from: FreeBSD 250140

Modified Paths:
--------------
    trunk/sys/netinet/tcp_input.c

Modified: trunk/sys/netinet/tcp_input.c
===================================================================
--- trunk/sys/netinet/tcp_input.c	2017-03-03 00:14:29 UTC (rev 9316)
+++ trunk/sys/netinet/tcp_input.c	2017-03-03 00:15:28 UTC (rev 9317)
@@ -270,7 +270,7 @@
 	INP_WLOCK_ASSERT(tp->t_inpcb);
 
 	tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
-	if (tp->snd_cwnd == min(tp->snd_cwnd, tp->snd_wnd))
+	if (tp->snd_cwnd <= tp->snd_wnd)
 		tp->ccv->flags |= CCF_CWND_LIMITED;
 	else
 		tp->ccv->flags &= ~CCF_CWND_LIMITED;



More information about the Midnightbsd-cvs mailing list