Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2016 19:17:39 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308384 - in head/sys/dev/rtwn: pci usb
Message-ID:  <201611061917.uA6JHdrs019645@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sun Nov  6 19:17:39 2016
New Revision: 308384
URL: https://svnweb.freebsd.org/changeset/base/308384

Log:
  rtwn_pci: omit tx_done() stage if device is not running.
  rtwn_usb: drain USB transfers during device shutdown; this fixes possible
  panic with 'options IEEE80211_SUPPORT_SUPERG' during device detach.
  
  Tested with RTL8188CE, STA mode.

Modified:
  head/sys/dev/rtwn/pci/rtwn_pci_rx.c
  head/sys/dev/rtwn/usb/rtwn_usb_attach.c

Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c
==============================================================================
--- head/sys/dev/rtwn/pci/rtwn_pci_rx.c	Sun Nov  6 19:16:46 2016	(r308383)
+++ head/sys/dev/rtwn/pci/rtwn_pci_rx.c	Sun Nov  6 19:17:39 2016	(r308384)
@@ -274,13 +274,14 @@ rtwn_pci_intr(void *arg)
 	status = rtwn_classify_intr(sc, &tx_rings, 0);
 	RTWN_DPRINTF(sc, RTWN_DEBUG_INTR, "%s: status %08X, tx_rings %08X\n",
 	    __func__, status, tx_rings);
-	if (status == 0 && tx_rings == 0) {
-		RTWN_UNLOCK(sc);
-		return;
-	}
+	if (status == 0 && tx_rings == 0)
+		goto unlock;
 
-	if (status & RTWN_PCI_INTR_RX)
+	if (status & RTWN_PCI_INTR_RX) {
 		rtwn_pci_rx_done(sc);
+		if (!(sc->sc_flags & RTWN_RUNNING))
+			goto unlock;
+	}
 
 	if (tx_rings != 0)
 		for (i = 0; i < RTWN_PCI_NTXQUEUES; i++)
@@ -289,5 +290,6 @@ rtwn_pci_intr(void *arg)
 
 	if (sc->sc_flags & RTWN_RUNNING)
 		rtwn_pci_enable_intr(pc);
+unlock:
 	RTWN_UNLOCK(sc);
 }

Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c
==============================================================================
--- head/sys/dev/rtwn/usb/rtwn_usb_attach.c	Sun Nov  6 19:16:46 2016	(r308383)
+++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c	Sun Nov  6 19:17:39 2016	(r308384)
@@ -273,8 +273,10 @@ rtwn_usb_abort_xfers(struct rtwn_softc *
 	RTWN_ASSERT_LOCKED(sc);
 
 	/* abort any pending transfers */
+	RTWN_UNLOCK(sc);
 	for (i = 0; i < RTWN_N_TRANSFER; i++)
-		usbd_transfer_stop(uc->uc_xfer[i]);
+		usbd_transfer_drain(uc->uc_xfer[i]);
+	RTWN_LOCK(sc);
 }
 
 static int



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