From owner-svn-src-head@freebsd.org Sat Sep 26 22:20:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 069B9A0ABF7; Sat, 26 Sep 2015 22:20:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB484102A; Sat, 26 Sep 2015 22:20:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8QMKUiU016184; Sat, 26 Sep 2015 22:20:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8QMKU3e016183; Sat, 26 Sep 2015 22:20:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509262220.t8QMKU3e016183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 26 Sep 2015 22:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288279 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Sat, 26 Sep 2015 22:20:31 -0000 Author: adrian Date: Sat Sep 26 22:20:30 2015 New Revision: 288279 URL: https://svnweb.freebsd.org/changeset/base/288279 Log: Free the TX/RX list buffers /before/ tearing down net80211 state. Otherwise buffers in the RX queue get freed with their parent vap being gone and you end up with a juicy kernel panic. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Sat Sep 26 22:20:11 2015 (r288278) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Sep 26 22:20:30 2015 (r288279) @@ -545,18 +545,25 @@ rsu_detach(device_t self) RSU_LOCK(sc); rsu_stop(sc); RSU_UNLOCK(sc); + usbd_transfer_unsetup(sc->sc_xfer, RSU_N_TRANSFER); + /* + * Free buffers /before/ we detach from net80211, else node + * references to destroyed vaps will lead to a panic. + */ + /* Free Tx/Rx buffers. */ + RSU_LOCK(sc); + rsu_free_tx_list(sc); + rsu_free_rx_list(sc); + RSU_UNLOCK(sc); + /* Frames are freed; detach from net80211 */ ieee80211_ifdetach(ic); taskqueue_drain_timeout(taskqueue_thread, &sc->calib_task); taskqueue_drain(taskqueue_thread, &sc->tx_task); - /* Free Tx/Rx buffers. */ - rsu_free_tx_list(sc); - rsu_free_rx_list(sc); - mtx_destroy(&sc->sc_mtx); return (0);