aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-07-21 23:42:15 +0000
committerXin LI <delphij@FreeBSD.org>2015-07-21 23:42:15 +0000
commit47a8e86509b258d16c4a36e2e475cb946bbc447c (patch)
tree0d0dcf8bd3b8463fc07cf63ab6138a8ebf8ff412 /sys/netinet/tcp_output.c
parenta5cbf8b9c06a20793b13badd84de93a1073fb84e (diff)
downloadsrc-47a8e86509b258d16c4a36e2e475cb946bbc447c.tar.gz
src-47a8e86509b258d16c4a36e2e475cb946bbc447c.zip
Fix resource exhaustion due to sessions stuck in LAST_ACK state.
Submitted by: Jonathan Looney (Juniper SIRT) Reviewed by: lstewart Security: CVE-2015-5358 Security: SA-15:13.tcp
Notes
Notes: svn path=/head/; revision=285777
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 111f22e2edda..9413721624cb 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -400,7 +400,7 @@ after_sack_rexmit:
flags &= ~TH_FIN;
}
- if (len < 0) {
+ if (len <= 0) {
/*
* If FIN has been sent but not acked,
* but we haven't been called to retransmit,
@@ -410,9 +410,16 @@ after_sack_rexmit:
* to (closed) window, and set the persist timer
* if it isn't already going. If the window didn't
* close completely, just wait for an ACK.
+ *
+ * We also do a general check here to ensure that
+ * we will set the persist timer when we have data
+ * to send, but a 0-byte window. This makes sure
+ * the persist timer is set even if the packet
+ * hits one of the "goto send" lines below.
*/
len = 0;
- if (sendwin == 0) {
+ if ((sendwin == 0) && (TCPS_HAVEESTABLISHED(tp->t_state)) &&
+ (off < (int) sbavail(&so->so_snd))) {
tcp_timer_activate(tp, TT_REXMT, 0);
tp->t_rxtshift = 0;
tp->snd_nxt = tp->snd_una;