summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_usrreq.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-09 10:40:58 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-02-09 10:40:58 +0000
commitc6fc3be9514938495b89e95cdd063ec99feebf27 (patch)
treedfa311ba3ec06592794193a1b5a2d2cc35ba42f9 /sys/kern/uipc_usrreq.c
parent93ee04e53f575530feb41827d95c86f808efa2f5 (diff)
Release the NET_LOCK() before calling unp_detach(), fix a recursion
found by dtucker@
Diffstat (limited to 'sys/kern/uipc_usrreq.c')
-rw-r--r--sys/kern/uipc_usrreq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 7ecafb4e600..b9cc8130d7d 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.113 2017/01/27 20:31:42 bluhm Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.114 2017/02/09 10:40:57 mpi Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -132,7 +132,10 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
case PRU_DETACH:
+ /* XXXSMP breaks atomicity */
+ rw_exit_write(&netlock);
unp_detach(unp);
+ rw_enter_write(&netlock);
break;
case PRU_BIND:
@@ -394,7 +397,7 @@ void
unp_detach(struct unpcb *unp)
{
struct vnode *vp;
-
+
LIST_REMOVE(unp, unp_link);
if (unp->unp_vnode) {
unp->unp_vnode->v_socket = NULL;