diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 201f9761350e..7052fea5d13a 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp) { struct ifnet *ifp = tp->tap_ifp; - /* Unlocked read. */ - KASSERT(!(tp->tap_flags & TAP_OPEN), - ("%s flags is out of sync", ifp->if_xname)); - CURVNET_SET(ifp->if_vnet); + destroy_dev(tp->tap_dev); seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); - destroy_dev(tp->tap_dev); ether_ifdetach(ifp); if_free(ifp); diff --git a/sys/net/if_tapvar.h b/sys/net/if_tapvar.h index 21bac5054d00..fb1c39a57b90 100644 --- a/sys/net/if_tapvar.h +++ b/sys/net/if_tapvar.h @@ -64,6 +64,7 @@ struct tap_softc { SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ struct cdev *tap_dev; struct mtx tap_mtx; /* per-softc mutex */ + struct cv tap_cv; /* protect ref'd dev destroy */ }; #endif /* !_NET_IF_TAPVAR_H_ */