MFC: rev 1.12: make sure that we call if_free(ifp) after bus_teardown_intr.

This eliminates the possibility of a crash due to getting an interrupt after
we free the ifp and the interrupt handler depending on ifp being still alive.
This commit is contained in:
obrien 2005-12-05 01:05:09 +00:00
parent f0786eeee2
commit 1331999374

View File

@ -559,12 +559,10 @@ nve_detach(device_t dev)
if (device_is_attached(dev)) {
nve_stop(sc);
/* XXX shouldn't hold lock over call to ether_ifdetch */
ether_ifdetach(ifp);
}
if (ifp)
if_free(ifp);
if (sc->miibus)
device_delete_child(dev, sc->miibus);
bus_generic_detach(dev);
@ -601,6 +599,8 @@ nve_detach(device_t dev)
bus_dma_tag_destroy(sc->rtag);
NVE_UNLOCK(sc);
if (ifp)
if_free(ifp);
mtx_destroy(&sc->mtx);
mtx_destroy(&sc->osmtx);