On Thu, Nov 13, 2025 at 11:05:46AM -0800, Mark McBride wrote:
> I can trigger a kernel panic if I start the syncthing service.
> 
> rcctl start syncthing_markmcb
> 
> ... wait 5-10 seconds ...
> 
> panic: netlock rwlock 0xffffff80012492d0: exit write when lock not held 
> (owner 0
> x10, self 0xffffff809ee7ad24)
> Stopped at      db_enter+0x18:  brk     #0xf000
>     TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
>   87509  73883   1000         0x3          0    2  syncthing
>  468519  73883   1000         0x3  0x4000000    3  syncthing
> * 29160  73883   1000         0x3  0x4000000    1  syncthing
> 3 22537  73883   1000         0x3  0x4000000    0  syncthing
> db_enter() at panic+0x138
> panic() at rw_exit_write+0xd0
> _rw_init_flags() at cad_ioctl+0x80
> cad_ioctl() at in_delmulti+0xbc
> in_delmulti() at ip_freemoptions+0x3c
> ip_freemoptions() at in_pcbdetach+0x5c
> in_pcbdetach() at udp_detach+0x2c
> 

We don't hold netlock wile performing SIOC{G,S}IFMEDIA ifioctl()
commands, so add them to exception list too.

I can't test this diff.

Index: sys/dev/fdt/if_cad.c
===================================================================
RCS file: /cvs/src/sys/dev/fdt/if_cad.c,v
retrieving revision 1.16
diff -u -p -r1.16 if_cad.c
--- sys/dev/fdt/if_cad.c        17 Sep 2025 09:17:12 -0000      1.16
+++ sys/dev/fdt/if_cad.c        13 Nov 2025 20:05:02 -0000
@@ -596,6 +596,8 @@ cad_ioctl(struct ifnet *ifp, u_long cmd,
        case SIOCGIFMEDIA:
        case SIOCSIFMEDIA:
        case SIOCGIFSFFPAGE:
+       case SIOCGIFMEDIA:
+       case SIOCSIFMEDIA:
                netlock_held = 0;
                break;
        }

Reply via email to