diff options
| author | 2016-06-13 21:24:43 +0000 | |
|---|---|---|
| committer | 2016-06-13 21:24:43 +0000 | |
| commit | 1b7a46918d884f2dfc8badad8305a5bff4d2ca9c (patch) | |
| tree | 31e0fe654044cd20cf1354626a42c12dabbe6bea /sys/netinet/tcp_output.c | |
| parent | Implement a timeout for the session initialization FSM. (diff) | |
| download | wireguard-openbsd-1b7a46918d884f2dfc8badad8305a5bff4d2ca9c.tar.xz wireguard-openbsd-1b7a46918d884f2dfc8badad8305a5bff4d2ca9c.zip | |
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/tcp_output.c')
| -rw-r--r-- | sys/netinet/tcp_output.c | 5 |
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. |
