iwm: Drain callouts after stopping the device during detach.

Otherwise there is a window where they may be rescheduled.  This
typically manifested as a page fault shortly after unloading if_iwm.ko.
Close the race by draining callouts after calling iwm_stop_device(),
which is also what Dragonfly does.

Change whitespace to reduce gratuitous diffs with Dragonfly.

Reported and tested by:	seanc
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2019-07-03 21:05:40 +00:00
parent 2302351791
commit dda0c86204

View File

@ -6330,12 +6330,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
if (!sc->sc_attached)
return 0;
sc->sc_attached = 0;
if (do_net80211)
if (do_net80211) {
ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task);
callout_drain(&sc->sc_led_blink_to);
callout_drain(&sc->sc_watchdog_to);
}
iwm_stop_device(sc);
if (do_net80211) {
IWM_LOCK(sc);
@ -6343,6 +6340,8 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
IWM_UNLOCK(sc);
ieee80211_ifdetach(&sc->sc_ic);
}
callout_drain(&sc->sc_led_blink_to);
callout_drain(&sc->sc_watchdog_to);
iwm_phy_db_free(sc->sc_phy_db);
sc->sc_phy_db = NULL;