summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-06-13 21:24:44 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-06-13 21:24:44 +0000
commit88d86ab5cf5a292a5ed3e5003bfb8172d6787116 (patch)
treefdfebb072738d75bd7cbabf51ed63c09927d9c95 /sys/netinet
parent6c049eef8f288bea7deaa6dc9bc2672f93802b3f (diff)
On localhost a user program may create a socket splicing loop.
After writing data into this loop, it was spinning forever causing a kernel hang. Detect the loop by counting how often the same mbuf is spliced. If that happens 128 times, assume that there is a loop and abort the splicing with ELOOP. Bug found by tedu@; OK tedu@ millert@ benno@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_output.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index ebffeb41691..bf67b1bf383 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.116 2015/12/05 10:52:26 tedu Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.117 2016/06/13 21:24:43 bluhm Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -732,6 +732,9 @@ send:
goto out;
}
}
+ if (so->so_snd.sb_mb->m_flags & M_PKTHDR)
+ m->m_pkthdr.ph_loopcnt =
+ so->so_snd.sb_mb->m_pkthdr.ph_loopcnt;
#endif
/*
* If we're sending everything we've got, set PUSH.