First the right address is picked from the net lock protected if_addrlist.
Then all ioctls just copy out the address, nothing requires the kernel lock.

SIOCGIFDSTADDR_IN6 checks the net lock protected if_flags,
SIOCGIFALIFETIME_IN6 computes lifetimes which only need the address.

Users of these ioctl(2)s are route6d(8), rad(8), slaacd(8), isakmpd(8) and
of course ifconfig(8).

OK?

This removes the last kernel lock from IPv6 read ioctls (multicast being
the untouched exception here).

diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 0f36b5ab332..9453a36ab1c 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -422,7 +422,6 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp)
                        return (error);
        }
 
-       KERNEL_LOCK();
        NET_LOCK_SHARED();
 
        if (sa6 != NULL) {
@@ -518,7 +517,6 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp)
 
 err:
        NET_UNLOCK_SHARED();
-       KERNEL_UNLOCK();
        return (error);
 }
 

Reply via email to