summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-07-13 16:19:38 +0000
committerbluhm <bluhm@openbsd.org>2017-07-13 16:19:38 +0000
commit789f384cc6da5087ebe6628fb8257ba025d6a94a (patch)
tree93bb47a7bd7b24ae15c2dd0cb03ac0cca9fcbcbe /sys/kern/uipc_socket.c
parenteqn(7) .EQ has to break man(7) next-line scope, or tree corruption (diff)
downloadwireguard-openbsd-789f384cc6da5087ebe6628fb8257ba025d6a94a.tar.xz
wireguard-openbsd-789f384cc6da5087ebe6628fb8257ba025d6a94a.zip
Do not unlock the netlock in the goto out error path before it has
been acquired in sosend(). Fixes a kernel lock assertion panic. OK visa@ mpi@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 8f686ee379a..0373749eeff 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.193 2017/07/08 09:19:02 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.194 2017/07/13 16:19:38 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -396,8 +396,9 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
resid = top->m_pkthdr.len;
/* MSG_EOR on a SOCK_STREAM socket is invalid. */
if (so->so_type == SOCK_STREAM && (flags & MSG_EOR)) {
- error = EINVAL;
- goto out;
+ m_freem(top);
+ m_freem(control);
+ return (EINVAL);
}
if (uio && uio->uio_procp)
uio->uio_procp->p_ru.ru_msgsnd++;