diff options
author | green <green@FreeBSD.org> | 2004-08-09 20:22:17 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-08-09 20:22:17 +0000 |
commit | 70d4e08f9d668b400e777ec76879a6753a0d8c19 (patch) | |
tree | f89420b2ad3a876ac93d574c99a72e4866104373 /sys/pci/if_rl.c | |
parent | ecbe8aa287d848dcb5b8888e61452b8f8fbf3f83 (diff) | |
download | FreeBSD-src-70d4e08f9d668b400e777ec76879a6753a0d8c19.zip FreeBSD-src-70d4e08f9d668b400e777ec76879a6753a0d8c19.tar.gz |
Fix rl(4)'s lock behavior upon deinitialization. I would get a panic
when kldunloading due to its private locking being acquired recursively.
Diffstat (limited to 'sys/pci/if_rl.c')
-rw-r--r-- | sys/pci/if_rl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 2da3b92..1fae9fe 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -1001,21 +1001,22 @@ rl_detach(device_t dev) { struct rl_softc *sc; struct ifnet *ifp; + int attached; sc = device_get_softc(dev); ifp = &sc->arpcom.ac_if; KASSERT(mtx_initialized(&sc->rl_mtx), ("rl mutex not initialized")); + attached = device_is_attached(dev); + /* These should only be active if attach succeeded */ + if (attached) + ether_ifdetach(ifp); RL_LOCK(sc); #if 0 sc->suspended = 1; #endif - - /* These should only be active if attach succeeded */ - if (device_is_attached(dev)) { + if (attached) rl_stop(sc); - ether_ifdetach(ifp); - } if (sc->rl_miibus) device_delete_child(dev, sc->rl_miibus); bus_generic_detach(dev); |