Another mechanical diff without semantic changes to avoid churn in
actual unlocking diffs.

OK?

Index: if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.666
diff -u -p -r1.666 if.c
--- if.c        8 Nov 2022 11:25:01 -0000       1.666
+++ if.c        8 Nov 2022 13:53:27 -0000
@@ -1979,9 +1979,7 @@ ifioctl(struct socket *so, u_long cmd, c
        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();
 
@@ -2527,6 +2529,8 @@ ifioctl_get(u_long cmd, caddr_t data)
        }
 
        NET_UNLOCK_SHARED();
+
+       KERNEL_UNLOCK();
 
        if_put(ifp);
 

Reply via email to