From fbc9d202d8476261f9242a92c7be7414194b9115 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 25 Sep 2016 19:13:07 +0000 Subject: [PATCH] rsu: do not restart calibration task when going out of RUN state. Clear 'sc_calibrating' flag and stop calibration task when interface is not associated; this fixes possible panic after detach. Reported and tested by: hselasky Reviewed by: adrian MFC after: 6 days --- sys/dev/usb/wlan/if_rsu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index c08b4af5dc74..4ee9decf4e2b 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -1270,9 +1270,12 @@ rsu_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) default: break; } - sc->sc_calibrating = 1; - /* Start periodic calibration. */ - taskqueue_enqueue_timeout(taskqueue_thread, &sc->calib_task, hz); + if (startcal != 0) { + sc->sc_calibrating = 1; + /* Start periodic calibration. */ + taskqueue_enqueue_timeout(taskqueue_thread, &sc->calib_task, + hz); + } RSU_UNLOCK(sc); IEEE80211_LOCK(ic); return (uvp->newstate(vap, nstate, arg));