summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-05-09 17:39:11 -0300
committerRenato Botelho <renato@netgate.com>2016-05-09 17:39:11 -0300
commiteb1aa95459d780e1328d821fd6af261c2221a62b (patch)
treed0c75db0de1902022252ffee3acbfe775366214c /sys/netinet/tcp_input.c
parent4a578420216361b8acfb7296dd0b68c805e5121b (diff)
parent1708fafa25d9413ab466d3670d803e2ebf885d45 (diff)
downloadFreeBSD-src-eb1aa95459d780e1328d821fd6af261c2221a62b.zip
FreeBSD-src-eb1aa95459d780e1328d821fd6af261c2221a62b.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 114802e..ecc7c9f 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2731,6 +2731,9 @@ process_ACK:
INP_WLOCK_ASSERT(tp->t_inpcb);
acked = BYTES_THIS_ACK(tp, th);
+ KASSERT(acked >= 0, ("%s: acked unexepectedly negative "
+ "(tp->snd_una=%u, th->th_ack=%u, tp=%p, m=%p)", __func__,
+ tp->snd_una, th->th_ack, tp, m));
TCPSTAT_INC(tcps_rcvackpack);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
@@ -2800,13 +2803,19 @@ process_ACK:
SOCKBUF_LOCK(&so->so_snd);
if (acked > so->so_snd.sb_cc) {
- tp->snd_wnd -= so->so_snd.sb_cc;
+ if (tp->snd_wnd >= so->so_snd.sb_cc)
+ tp->snd_wnd -= so->so_snd.sb_cc;
+ else
+ tp->snd_wnd = 0;
mfree = sbcut_locked(&so->so_snd,
(int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
mfree = sbcut_locked(&so->so_snd, acked);
- tp->snd_wnd -= acked;
+ if (tp->snd_wnd >= (u_long) acked)
+ tp->snd_wnd -= acked;
+ else
+ tp->snd_wnd = 0;
ourfinisacked = 0;
}
/* NB: sowwakeup_locked() does an implicit unlock. */
OpenPOWER on IntegriCloud