summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-07-13 16:19:39 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-07-13 16:19:39 +0000
commit6fbbe3dfadd13803d9ab16e235bf322b07f5f0a3 (patch)
treea10c6a266a7acc5c194e33fde3a6f197a839045a /sys/kern
parentafc8f417ff4d6e6421303bd7edf67c92ac99b858 (diff)
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')
-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++;