Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2019 00:31:58 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r343992 - in stable: 11/sys/dev/iwn 12/sys/dev/iwn
Message-ID:  <201902110031.x1B0Vwtn056123@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Mon Feb 11 00:31:58 2019
New Revision: 343992
URL: https://svnweb.freebsd.org/changeset/base/343992

Log:
  MFC r343815:
  iwn(4): plug initialization path vs interrupt handler races
  
  There are few places in interrupt handler where the driver
  lock is dropped; ensure that device is still running before
  processing remaining ring entries.
  
  PR:		192641

Modified:
  stable/11/sys/dev/iwn/if_iwn.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/iwn/if_iwn.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/iwn/if_iwn.c
==============================================================================
--- stable/11/sys/dev/iwn/if_iwn.c	Mon Feb 11 00:11:02 2019	(r343991)
+++ stable/11/sys/dev/iwn/if_iwn.c	Mon Feb 11 00:31:58 2019	(r343992)
@@ -3801,6 +3801,7 @@ iwn_notif_intr(struct iwn_softc *sc)
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	uint16_t hw;
+	int is_stopped;
 
 	bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map,
 	    BUS_DMASYNC_POSTREAD);
@@ -3832,6 +3833,11 @@ iwn_notif_intr(struct iwn_softc *sc)
 		case IWN_MPDU_RX_DONE:
 			/* An 802.11 frame has been received. */
 			iwn_rx_done(sc, desc, data);
+
+			is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
+			if (__predict_false(is_stopped))
+				return;
+
 			break;
 
 		case IWN_RX_COMPRESSED_BA:
@@ -3874,6 +3880,11 @@ iwn_notif_intr(struct iwn_softc *sc)
 					IWN_UNLOCK(sc);
 					ieee80211_beacon_miss(ic);
 					IWN_LOCK(sc);
+
+					is_stopped = (sc->sc_flags &
+					    IWN_FLAG_RUNNING) == 0;
+					if (__predict_false(is_stopped))
+						return;
 				}
 			}
 			break;
@@ -3950,6 +3961,11 @@ iwn_notif_intr(struct iwn_softc *sc)
 			IWN_UNLOCK(sc);
 			ieee80211_scan_next(vap);
 			IWN_LOCK(sc);
+
+			is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
+			if (__predict_false(is_stopped))  
+				return;
+
 			break;
 		}
 		case IWN5000_CALIBRATION_RESULT:



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