diff options
author | 2017-01-26 00:08:50 +0000 | |
---|---|---|
committer | 2017-01-26 00:08:50 +0000 | |
commit | ebac595116f75d552c9ae281d624d423f4537e2a (patch) | |
tree | 866f27b4f5fa955549035fc5154daacf4ec115ea /sys/kern/uipc_socket.c | |
parent | split the tls_init(3) that had grown fat to allow healthy future growth; (diff) | |
download | wireguard-openbsd-ebac595116f75d552c9ae281d624d423f4537e2a.tar.xz wireguard-openbsd-ebac595116f75d552c9ae281d624d423f4537e2a.zip |
Do not hold the netlock while pool_get() may sleep. It is not
necessary to lock code that initializes a new socket structure
before it has been linked to any global list.
OK mpi@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 186fc918b98..10f82b9d272 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.173 2017/01/25 16:45:50 bluhm Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.174 2017/01/26 00:08:50 bluhm Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -123,7 +123,6 @@ socreate(int dom, struct socket **aso, int type, int proto) return (EPROTONOSUPPORT); if (prp->pr_type != type) return (EPROTOTYPE); - NET_LOCK(s); so = pool_get(&socket_pool, PR_WAITOK | PR_ZERO); TAILQ_INIT(&so->so_q0); TAILQ_INIT(&so->so_q); @@ -136,6 +135,7 @@ socreate(int dom, struct socket **aso, int type, int proto) so->so_egid = p->p_ucred->cr_gid; so->so_cpid = p->p_p->ps_pid; so->so_proto = prp; + NET_LOCK(s); error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL, (struct mbuf *)(long)proto, NULL, p); if (error) { |