Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 May 2008 22:37:42 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 141482 for review
Message-ID:  <200805112237.m4BMbg1i025287@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=141482

Change 141482 by sam@sam_ebb on 2008/05/11 22:36:41

	don't use iv_bss unless we're in RUN state; fixes a crash when
	scanning is restarted after failing to find a suitable ap
	Reported by:	flz

Affected files ...

.. //depot/projects/vap/sys/dev/ral/rt2560.c#37 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#35 edit

Differences ...

==== //depot/projects/vap/sys/dev/ral/rt2560.c#37 (text) ====

@@ -2291,6 +2291,9 @@
 	uint16_t logcwmin, preload;
 	uint32_t tmp;
 
+	KASSERT(vap->iv_state == IEEE80211_S_RUN,
+	    ("in %d state", vap->iv_state));
+
 	/* first, disable TSF synchronization */
 	RAL_WRITE(sc, RT2560_CSR14, 0);
 
@@ -2564,9 +2567,10 @@
 	struct rt2560_softc *sc = ifp->if_softc;
 	struct ieee80211vap *vap = ic->ic_scan->ss_vap;
 
-	rt2560_enable_tsf_sync(sc);
-	/* XXX keep local copy */
-	rt2560_set_bssid(sc, vap->iv_bss->ni_bssid);
+	if (vap->iv_state == IEEE80211_S_RUN) {
+		rt2560_enable_tsf_sync(sc);
+		rt2560_set_bssid(sc, vap->iv_bss->ni_bssid);
+	}
 }
 
 static int

==== //depot/projects/vap/sys/dev/ral/rt2661.c#35 (text) ====

@@ -2784,6 +2784,9 @@
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	uint32_t tmp;
 
+	KASSERT(vap->iv_state == IEEE80211_S_RUN,
+	    ("in %d state", vap->iv_state));
+
 	if (vap->iv_opmode != IEEE80211_M_STA) {
 		/*
 		 * Change default 16ms TBTT adjustment to 8ms.
@@ -2873,9 +2876,11 @@
 	struct rt2661_softc *sc = ifp->if_softc;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 
-	rt2661_enable_tsf_sync(sc);
-	/* XXX keep local copy */
-	rt2661_set_bssid(sc, vap->iv_bss->ni_bssid);
+	if (vap->iv_state == IEEE80211_S_RUN) {
+		rt2661_enable_tsf_sync(sc);
+		/* XXX keep local copy */
+		rt2661_set_bssid(sc, vap->iv_bss->ni_bssid);
+	}
 }
 
 static void



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