From owner-svn-src-head@freebsd.org Wed Jul 3 21:05:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1375015E1340; Wed, 3 Jul 2019 21:05:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE5A46B9E0; Wed, 3 Jul 2019 21:05:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7853D194B8; Wed, 3 Jul 2019 21:05:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x63L5fFY018881; Wed, 3 Jul 2019 21:05:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x63L5f6d018880; Wed, 3 Jul 2019 21:05:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907032105.x63L5f6d018880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 3 Jul 2019 21:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349711 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 349711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AE5A46B9E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jul 2019 21:05:42 -0000 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;