From 90013b20c2ac9fe8797f57a312201931661d5d2b Mon Sep 17 00:00:00 2001 From: lstewart Date: Wed, 1 May 2013 08:57:45 +0000 Subject: [PATCH] MFC r245783: 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 Submitted by: jhb git-svn-id: svn://svn.freebsd.org/base/stable/8@250141 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netinet/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 5aacfc013..aa6478e25 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -269,7 +269,7 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type) 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; -- 2.45.0