Hello,
>
> I agree we should protect against that - if I add a sleep there, I can easily
> cause a panic with 'ifconfig vlan10 destroy & ifconfig vlan10 destroy'.
> I think that's a separate issue though, as the same window is present in
> the existing code.
>
that's true. it's refcnt_finalize() in vlan_clone_destroy(), what's made it
somewhat more obvious.
> This fixes it, at least in my brief testing:
>
> Index: if_vlan.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_vlan.c,v
> retrieving revision 1.202
> diff -u -p -u -p -r1.202 if_vlan.c
> --- if_vlan.c 7 Nov 2019 07:36:32 -0000 1.202
> +++ if_vlan.c 27 Jan 2020 03:47:24 -0000
> @@ -249,6 +249,10 @@ vlan_clone_destroy(struct ifnet *ifp)
> struct vlan_softc *sc = ifp->if_softc;
>
> NET_LOCK();
> + if (sc->sc_dead != 0) {
> + NET_UNLOCK();
> + return (ENXIO);
> + }
> sc->sc_dead = 1;
>
> if (ISSET(ifp->if_flags, IFF_RUNNING))
>
yes, that's perfect. I'm OK with your change.
thanks and
regards
sashan