Unlock SIOCGIFG{MEMB,ATTR,LIST}
authorkn <kn@openbsd.org>
Mon, 14 Nov 2022 22:45:02 +0000 (22:45 +0000)
committerkn <kn@openbsd.org>
Mon, 14 Nov 2022 22:45:02 +0000 (22:45 +0000)
The global interface group list is also protected by the net lock and all
access to it (all within if.c) take it accordingly.

Getting all
- members    of a group (SIOCGIFGMEMB),
- attributes of a group (SIOCGIFGATTR),
- groups                (SIOCGIFGLIST)
are each read-only operations on the global interface group `ifg_head'.

The global interface list `ifnetlist' or its per-interface group lists are
not used in these ioctls.

OK mvs

sys/net/if.c

index d62b40b..f3fba33 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if.c,v 1.679 2022/11/14 22:07:30 kn Exp $     */
+/*     $OpenBSD: if.c,v 1.680 2022/11/14 22:45:02 kn Exp $     */
 /*     $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $  */
 
 /*
@@ -2427,25 +2427,19 @@ ifioctl_get(u_long cmd, caddr_t data)
                error = if_clone_list((struct if_clonereq *)data);
                return (error);
        case SIOCGIFGMEMB:
-               KERNEL_LOCK();
                NET_LOCK_SHARED();
                error = if_getgroupmembers(data);
                NET_UNLOCK_SHARED();
-               KERNEL_UNLOCK();
                return (error);
        case SIOCGIFGATTR:
-               KERNEL_LOCK();
                NET_LOCK_SHARED();
                error = if_getgroupattribs(data);
                NET_UNLOCK_SHARED();
-               KERNEL_UNLOCK();
                return (error);
        case SIOCGIFGLIST:
-               KERNEL_LOCK();
                NET_LOCK_SHARED();
                error = if_getgrouplist(data);
                NET_UNLOCK_SHARED();
-               KERNEL_UNLOCK();
                return (error);
        }