The `if_cloners’ list is immutable. You don't need kernel lock around if_clone_list() call.
> case SIOCIFGCLONERS: > + KERNEL_LOCK(); > error = if_clone_list((struct if_clonereq *)data); > + KERNEL_UNLOCK(); > return (error); With this fix diff looks good for me. > On 8 Nov 2022, at 18:28, Klemens Nanni <k...@openbsd.org> wrote: > > After this mechanical move, I can unlock the individual SIOCG* in there. > > OK? > > Index: if.c > =================================================================== > RCS file: /cvs/src/sys/net/if.c,v > retrieving revision 1.667 > diff -u -p -r1.667 if.c > --- if.c 8 Nov 2022 15:20:24 -0000 1.667 > +++ if.c 8 Nov 2022 15:26:07 -0000 > @@ -2426,33 +2426,43 @@ ifioctl_get(u_long cmd, caddr_t data) > size_t bytesdone; > const char *label; > > - KERNEL_LOCK(); > - > switch(cmd) { > case SIOCGIFCONF: > + KERNEL_LOCK(); > NET_LOCK_SHARED(); > error = ifconf(data); > NET_UNLOCK_SHARED(); > + KERNEL_UNLOCK(); > return (error); > case SIOCIFGCLONERS: > + KERNEL_LOCK(); > error = if_clone_list((struct if_clonereq *)data); > + KERNEL_UNLOCK(); > 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); > } > + > + KERNEL_LOCK(); > > ifp = if_unit(ifr->ifr_name); > if (ifp == NULL) { >