summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/wlan/if_run.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2010-09-02 03:28:03 +0000
committerthompsa <thompsa@FreeBSD.org>2010-09-02 03:28:03 +0000
commit1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5 (patch)
tree96181ac569fa147859c67d6e8334673d021645fe /sys/dev/usb/wlan/if_run.c
parent5621f791d2277c43041de7701e15cbcfa9b6dd87 (diff)
downloadFreeBSD-src-1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5.zip
FreeBSD-src-1a84f8ba2ae2f9c4b0376b200c9e1c505ea1f6e5.tar.gz
We need to grab a node reference count to vap->iv_bss before using it as it is
possible for the node to be replaced and freed at any time by ieee80211_sta_join1().
Diffstat (limited to 'sys/dev/usb/wlan/if_run.c')
-rw-r--r--sys/dev/usb/wlan/if_run.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index 6c9afb9..d6cbf3a 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -1693,7 +1693,6 @@ run_media_change(struct ifnet *ifp)
struct ieee80211com *ic = vap->iv_ic;
const struct ieee80211_txparam *tp;
struct run_softc *sc = ic->ic_ifp->if_softc;
- struct run_node *rn = (void *)vap->iv_bss;
uint8_t rate, ridx;
int error;
@@ -1707,13 +1706,19 @@ run_media_change(struct ifnet *ifp)
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
+ struct ieee80211_node *ni;
+ struct run_node *rn;
+
rate = ic->ic_sup_rates[ic->ic_curmode].
rs_rates[tp->ucastrate] & IEEE80211_RATE_VAL;
for (ridx = 0; ridx < RT2860_RIDX_MAX; ridx++)
if (rt2860_rates[ridx].rate == rate)
break;
+ ni = ieee80211_ref_node(vap->iv_bss);
+ rn = (struct run_node *)ni;
rn->fix_ridx = ridx;
DPRINTF("rate=%d, fix_ridx=%d\n", rate, rn->fix_ridx);
+ ieee80211_free_node(ni);
}
#if 0
@@ -1736,7 +1741,6 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
struct run_softc *sc = ic->ic_ifp->if_softc;
struct run_vap *rvp = RUN_VAP(vap);
enum ieee80211_state ostate;
- struct ieee80211_node *ni;
uint32_t sta[3];
uint32_t tmp;
uint8_t ratectl;
@@ -1781,7 +1785,6 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
case IEEE80211_S_RUN:
- ni = vap->iv_bss;
if (!(sc->runbmap & bid)) {
if(sc->running++)
restart_ratectl = 1;
@@ -1817,12 +1820,16 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
}
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
+ struct ieee80211_node *ni;
+
run_updateslot(ic->ic_ifp);
run_enable_mrr(sc);
run_set_txpreamble(sc);
run_set_basicrates(sc);
+ ni = ieee80211_ref_node(vap->iv_bss);
IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid);
run_set_bssid(sc, ni->ni_bssid);
+ ieee80211_free_node(ni);
run_enable_tsf_sync(sc);
/* enable automatic rate adaptation */
OpenPOWER on IntegriCloud