summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-10-06 17:02:10 +0000
committerbluhm <bluhm@openbsd.org>2016-10-06 17:02:10 +0000
commit7dc2a26873a1a1c590cda703ec43c0684f012ae6 (patch)
tree29e8d7aca34434878f0c5afabe0abbf4c5abe771
parentRemove _ds_boundary abuse (again) (diff)
downloadwireguard-openbsd-7dc2a26873a1a1c590cda703ec43c0684f012ae6.tar.xz
wireguard-openbsd-7dc2a26873a1a1c590cda703ec43c0684f012ae6.zip
Separate splsoftnet() from variable initialization.
From mpi@'s netlock diff; OK mikeb@
-rw-r--r--sys/kern/sys_socket.c5
-rw-r--r--sys/kern/uipc_socket.c17
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 20e2fa1318b..7a90f780067 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_socket.c,v 1.21 2015/12/05 10:11:53 tedu Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.22 2016/10/06 17:02:10 bluhm Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@@ -131,8 +131,9 @@ soo_poll(struct file *fp, int events, struct proc *p)
{
struct socket *so = fp->f_data;
int revents = 0;
- int s = splsoftnet();
+ int s;
+ s = splsoftnet();
if (events & (POLLIN | POLLRDNORM)) {
if (soreadable(so))
revents |= events & (POLLIN | POLLRDNORM);
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 86e737251c8..4ef4aed9fbc 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.161 2016/09/20 14:27:43 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.162 2016/10/06 17:02:10 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -152,9 +152,9 @@ socreate(int dom, struct socket **aso, int type, int proto)
int
sobind(struct socket *so, struct mbuf *nam, struct proc *p)
{
- int s = splsoftnet();
- int error;
+ int s, error;
+ s = splsoftnet();
error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, NULL, nam, NULL, p);
splx(s);
return (error);
@@ -234,9 +234,9 @@ int
soclose(struct socket *so)
{
struct socket *so2;
- int s = splsoftnet(); /* conservative */
- int error = 0;
+ int s, error = 0;
+ s = splsoftnet();
if (so->so_options & SO_ACCEPTCONN) {
while ((so2 = TAILQ_FIRST(&so->so_q0)) != NULL) {
(void) soqremque(so2, 0);
@@ -318,8 +318,7 @@ soaccept(struct socket *so, struct mbuf *nam)
int
soconnect(struct socket *so, struct mbuf *nam)
{
- int s;
- int error;
+ int s, error;
if (so->so_options & SO_ACCEPTCONN)
return (EOPNOTSUPP);
@@ -344,9 +343,9 @@ soconnect(struct socket *so, struct mbuf *nam)
int
soconnect2(struct socket *so1, struct socket *so2)
{
- int s = splsoftnet();
- int error;
+ int s, error;
+ s = splsoftnet();
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL,
(struct mbuf *)so2, NULL, curproc);
splx(s);