summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-30 14:01:03 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-30 14:01:03 +0000
commit577b9cd7a6d6dacd17b32c21694803b76e458dad (patch)
treefb6d123600fd5cdd27a6651edd3a125b2f224695 /sys/netinet6
parent44d797b28dbfd6fd7302b8c02c9252298dad5bba (diff)
Unlock nd6_ioctl(), push kernel lock into in6_ioctl_{get,change_ifaddr}()
Neighbour Discovery information is protected by the net lock, as documented in nd6.h struct nd_ifinfo. ndp(8) is the only SIOCGIFINFO_IN6 and SIOCGNBRINFO_IN6 user in base. nd6_lookup(), also used in ICMP6 input and IPv6 forwarding, only needs the net lock. OK mvs
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 44dfa3488ef..0f36b5ab332 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.256 2022/11/23 14:48:28 kn Exp $ */
+/* $OpenBSD: in6.c,v 1.257 2022/11/30 14:01:02 kn Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -213,9 +213,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
break;
#endif /* MROUTING */
default:
- KERNEL_LOCK();
error = in6_ioctl(cmd, data, ifp, privileged);
- KERNEL_UNLOCK();
break;
}
@@ -296,6 +294,7 @@ in6_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp)
return (error);
}
+ KERNEL_LOCK();
NET_LOCK();
if (sa6 != NULL) {
@@ -402,6 +401,7 @@ in6_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp)
err:
NET_UNLOCK();
+ KERNEL_UNLOCK();
return (error);
}
@@ -422,6 +422,7 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp)
return (error);
}
+ KERNEL_LOCK();
NET_LOCK_SHARED();
if (sa6 != NULL) {
@@ -517,6 +518,7 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp)
err:
NET_UNLOCK_SHARED();
+ KERNEL_UNLOCK();
return (error);
}