Author: markj
Date: Wed Jul  3 21:05:40 2019
New Revision: 349711
URL: https://svnweb.freebsd.org/changeset/base/349711

Log:
  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

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c   Wed Jul  3 20:55:08 2019        (r349710)
+++ head/sys/dev/iwm/if_iwm.c   Wed Jul  3 21:05:40 2019        (r349711)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to