On Sat, Aug 06, 2022 at 11:33:46PM +0000, mgra...@brainfat.net wrote:
>         after creating a bridge interface running an ifconfig command will 
> crash the system.

> c: netlock: lock not held
> rw_exit_write(ffffffff822af5e8) at rw_exit_write+0xae
> bridge_ioctl(ffff8000005e4000,c0406938,ffff80000e663820) at bridge_ioctl+0x42
> ifioctl(fffffd801803b5a8,c0406938,ffff80000e663820,ffff80000e669268) at 
> ifioctl

SIOCGIFMEDIA is 0xc0406938.  This is fallout of my netlock removal
from media ioctl.  The bridge does not support media parameter, so
just skip it.

Does this diff fix it?

bluhm

Index: net/if_bridge.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_bridge.c,v
retrieving revision 1.363
diff -u -p -r1.363 if_bridge.c
--- net/if_bridge.c     4 Jan 2022 06:32:39 -0000       1.363
+++ net/if_bridge.c     6 Aug 2022 23:44:31 -0000
@@ -262,8 +262,13 @@ bridge_ioctl(struct ifnet *ifp, u_long c
        /*
         * bridge(4) data structure aren't protected by the NET_LOCK().
         * Idealy it shouldn't be taken before calling `ifp->if_ioctl'
-        * but we aren't there yet.
+        * but we aren't there yet.  Media ioctl run without netlock.
         */
+       switch (cmd) {
+       case SIOCSIFMEDIA:
+       case SIOCGIFMEDIA:
+               return (ENOTTY);
+       }
        NET_UNLOCK();
 
        switch (cmd) {

Reply via email to