From: kn Date: Wed, 30 Nov 2022 14:01:02 +0000 (+0000) Subject: Unlock nd6_ioctl(), push kernel lock into in6_ioctl_{get,change_ifaddr}() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3cf38294b8ab064d3520e99d735abec782967927;p=openbsd 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 --- 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); }