diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 8094fe35256c..56bbf120caff 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2841,10 +2841,12 @@ void netmap_detach(struct ifnet *ifp) { struct netmap_adapter *na = NA(ifp); + int skip; if (!na) return; + skip = 0; NMG_LOCK(); netmap_disable_all_rings(ifp); na->ifp = NULL; @@ -2856,10 +2858,11 @@ netmap_detach(struct ifnet *ifp) * the driver is gone. */ if (na->na_flags & NAF_NATIVE) { - netmap_adapter_put(na); + skip = netmap_adapter_put(na); } /* give them a chance to notice */ - netmap_enable_all_rings(ifp); + if (skip == 0) + netmap_enable_all_rings(ifp); NMG_UNLOCK(); }