summaryrefslogtreecommitdiff
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-04-15 13:24:48 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-04-15 13:24:48 +0000
commit3f7637592ebd04b8f0b769efb88ebb6b1d1e0b7b (patch)
treed8c082968a4d26151dc8d089fa3ad5552f335df3 /sys/netinet/in.c
parent755513acd2ac6150e3bce93a9a0d26a6805aba98 (diff)
Unlock in_ioctl_get(), push kernel lock into in_ioctl_{set,change}_ifaddr()
Just like in6_ioctl_get(), read ioctls are safe with the shared net lock to protect interface addresses and flags. OK mvs
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index fa778ef580f..ffc8ebc9bf5 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.179 2022/12/06 22:19:39 mvs Exp $ */
+/* $OpenBSD: in.c,v 1.180 2023/04/15 13:24:47 kn Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -216,9 +216,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
break;
#endif /* MROUTING */
default:
- KERNEL_LOCK();
error = in_ioctl(cmd, data, ifp, privileged);
- KERNEL_UNLOCK();
break;
}
@@ -262,6 +260,7 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
return (error);
}
+ KERNEL_LOCK();
NET_LOCK();
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
@@ -348,6 +347,7 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
}
err:
NET_UNLOCK();
+ KERNEL_UNLOCK();
return (error);
}
@@ -372,6 +372,7 @@ in_ioctl_set_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
if (error)
return (error);
+ KERNEL_LOCK();
NET_LOCK();
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
@@ -406,6 +407,7 @@ in_ioctl_set_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
if_addrhooks_run(ifp);
NET_UNLOCK();
+ KERNEL_UNLOCK();
return error;
}
@@ -427,6 +429,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
return (error);
}
+ KERNEL_LOCK();
NET_LOCK();
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
@@ -555,6 +558,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
}
NET_UNLOCK();
+ KERNEL_UNLOCK();
return (error);
}