Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jul 2019 21:05:41 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349711 - head/sys/dev/iwm
Message-ID:  <201907032105.x63L5f6d018880@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907032105.x63L5f6d018880>