diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-26 00:08:51 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-26 00:08:51 +0000 |
commit | 9bb65b93593a57b665428aecec19f480e535c9cd (patch) | |
tree | 8605640d06adbd391de4e864d6de8e066ac4056e /sys/kern/uipc_socket.c | |
parent | b21460e45d1fd15b11e108f838f3ae3e4c8bcdd1 (diff) |
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) { |