summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-02-19 11:35:42 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-02-19 11:35:42 +0000
commitebcc90bf1864b82f8e13c4ad8295219b246f3370 (patch)
treec76bd63e6f220ba6913c62983388103795522182 /sys/kern
parent7cbd729d49b62edc3d073334c91e791f1bb37634 (diff)
Grab solock() inside soconnect2() instead of asserting for it to be held.
ok millert@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c7
-rw-r--r--sys/kern/uipc_syscalls.c8
2 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index ace43c11592..2f696b36001 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.216 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.217 2018/02/19 11:35:41 mpi Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -337,11 +337,12 @@ soconnect(struct socket *so, struct mbuf *nam)
int
soconnect2(struct socket *so1, struct socket *so2)
{
- int error;
+ int s, error;
- soassertlocked(so1);
+ s = solock(so1);
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL,
(struct mbuf *)so2, NULL, curproc);
+ sounlock(s);
return (error);
}
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 9eeb53281ed..0c058ffec15 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.165 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.166 2018/02/19 11:35:41 mpi Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -447,7 +447,7 @@ sys_socketpair(struct proc *p, void *v, register_t *retval)
struct filedesc *fdp = p->p_fd;
struct file *fp1, *fp2;
struct socket *so1, *so2;
- int s, type, cloexec, nonblock, fflag, error, sv[2];
+ int type, cloexec, nonblock, fflag, error, sv[2];
type = SCARG(uap, type) & ~(SOCK_CLOEXEC | SOCK_NONBLOCK);
cloexec = (SCARG(uap, type) & SOCK_CLOEXEC) ? UF_EXCLOSE : 0;
@@ -461,9 +461,7 @@ sys_socketpair(struct proc *p, void *v, register_t *retval)
if (error)
goto free1;
- s = solock(so1);
error = soconnect2(so1, so2);
- sounlock(s);
if (error != 0)
goto free2;
@@ -471,9 +469,7 @@ sys_socketpair(struct proc *p, void *v, register_t *retval)
/*
* Datagram socket connection is asymmetric.
*/
- s = solock(so2);
error = soconnect2(so2, so1);
- sounlock(s);
if (error != 0)
goto free2;
}