diff options
Diffstat (limited to 'sys/dev/usb/wlan/if_run.c')
-rw-r--r-- | sys/dev/usb/wlan/if_run.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index 394063639887..dd29b4031b4a 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -716,11 +716,14 @@ run_detach(device_t self) struct ieee80211com *ic; int i; + RUN_LOCK(sc); + sc->sc_detached = 1; + RUN_UNLOCK(sc); + /* stop all USB transfers */ usbd_transfer_unsetup(sc->sc_xfer, RUN_N_XFER); RUN_LOCK(sc); - sc->ratectl_run = RUN_RATECTL_OFF; sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; @@ -3441,7 +3444,13 @@ run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ifreq *ifr = (struct ifreq *) data; int startall = 0; - int error = 0; + int error; + + RUN_LOCK(sc); + error = sc->sc_detached ? ENXIO : 0; + RUN_UNLOCK(sc); + if (error) + return (error); switch (cmd) { case SIOCSIFFLAGS: @@ -4963,8 +4972,7 @@ static device_method_t run_methods[] = { DEVMETHOD(device_probe, run_match), DEVMETHOD(device_attach, run_attach), DEVMETHOD(device_detach, run_detach), - - { 0, 0 } + DEVMETHOD_END }; static driver_t run_driver = { |