summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-08 15:20:25 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-08 15:20:25 +0000
commit5f02494c220a42c99020fcad363afe9a86425e1e (patch)
treee0c030ce609c794a66612503c4ce8c121a45bf25 /sys/net/if.c
parent85494070a32e7ab96cb0bb02fa326ed5836cfe45 (diff)
Push kernel lock into ifioctl_get()
Another mechanical diff without semantic changes to avoid churn in actual unlocking diffs. OK mpi
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 28529df236b..58a972b802c 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.666 2022/11/08 11:25:01 kn Exp $ */
+/* $OpenBSD: if.c,v 1.667 2022/11/08 15:20:24 kn Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1979,9 +1979,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
case SIOCGIFRDOMAIN:
case SIOCGIFGROUP:
case SIOCGIFLLPRIO:
- KERNEL_LOCK();
error = ifioctl_get(cmd, data);
- KERNEL_UNLOCK();
return (error);
}
@@ -2428,6 +2426,8 @@ ifioctl_get(u_long cmd, caddr_t data)
size_t bytesdone;
const char *label;
+ KERNEL_LOCK();
+
switch(cmd) {
case SIOCGIFCONF:
NET_LOCK_SHARED();
@@ -2455,8 +2455,10 @@ ifioctl_get(u_long cmd, caddr_t data)
}
ifp = if_unit(ifr->ifr_name);
- if (ifp == NULL)
+ if (ifp == NULL) {
+ KERNEL_UNLOCK();
return (ENXIO);
+ }
NET_LOCK_SHARED();
@@ -2528,6 +2530,8 @@ ifioctl_get(u_long cmd, caddr_t data)
NET_UNLOCK_SHARED();
+ KERNEL_UNLOCK();
+
if_put(ifp);
return (error);