rename flags and add a ZYD_FLAG_DETACHING flag to indicate we're

detaching that when the USB is pulled out forcibly during the driver is
running background scan, a page fault can be occurred even if we called
usb_rem_task() when detaching.  It looks like a kind of races.
This commit is contained in:
Weongyo Jeong 2008-09-10 03:40:51 +00:00
parent bc452c1162
commit d8cabb0b9e
2 changed files with 9 additions and 2 deletions

View File

@ -268,7 +268,7 @@ zyd_attachhook(struct zyd_softc *sc)
return error;
}
sc->sc_flags |= ZD1211_FWLOADED;
sc->sc_flags |= ZYD_FLAG_FWLOADED;
/* complete the attach process */
return zyd_complete_attach(sc);
@ -451,6 +451,9 @@ zyd_detach(device_t dev)
if (!device_is_attached(dev))
return 0;
/* set a flag to indicate we're detaching. */
sc->sc_flags |= ZYD_FLAG_DETACHING;
/* protect a race when we have listeners related with the driver. */
ifp->if_flags &= ~IFF_UP;
@ -2743,6 +2746,9 @@ zyd_scantask(void *arg)
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = ifp->if_l2com;
if (sc->sc_flags & ZYD_FLAG_DETACHING)
return;
ZYD_LOCK(sc);
switch (sc->sc_scan_action) {

View File

@ -1198,8 +1198,9 @@ struct zyd_softc {
usbd_device_handle sc_udev;
usbd_interface_handle sc_iface;
int sc_flags;
#define ZYD_FLAG_FWLOADED (1 << 0)
#define ZYD_FLAG_DETACHING (1 << 1)
int sc_if_flags;
#define ZD1211_FWLOADED (1 << 0)
uint8_t sc_bssid[IEEE80211_ADDR_LEN];
enum ieee80211_state sc_state;