From 3a62b4a7336181ae37db9b9849b92f2bcd191ed9 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Sat, 6 Mar 2010 13:47:53 +0100 Subject: [PATCH] Fixed several invalid VAP accesses --- rt2860.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rt2860.c b/rt2860.c index 0006670..cd6699e 100644 --- a/rt2860.c +++ b/rt2860.c @@ -3059,19 +3059,21 @@ static void rt2860_asic_update_rtsthreshold(struct rt2860_softc *sc) ic = ifp->if_l2com; vap = TAILQ_FIRST(&ic->ic_vaps); + if (vap == NULL) + threshold = IEEE80211_RTS_MAX; + else if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX) + threshold = 0x1000; + else + threshold = vap->iv_rtsthreshold; + RT2860_DPRINTF(sc, RT2860_DEBUG_PROT, "%s: updating RTS threshold: %d\n", - device_get_nameunit(sc->dev), vap->iv_rtsthreshold); + device_get_nameunit(sc->dev), threshold); tmp = rt2860_io_mac_read(sc, RT2860_REG_TX_RTS_CFG); tmp &= ~(RT2860_REG_TX_RTS_THRESHOLD_MASK << RT2860_REG_TX_RTS_THRESHOLD_SHIFT); - if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX) - threshold = 0x1000; - else - threshold = vap->iv_rtsthreshold; - tmp |= ((threshold & RT2860_REG_TX_RTS_THRESHOLD_MASK) << RT2860_REG_TX_RTS_THRESHOLD_SHIFT); @@ -3243,7 +3245,7 @@ static void rt2860_asic_updateprot(struct rt2860_softc *sc) /* HT frame protection */ - if ((vap->iv_opmode == IEEE80211_M_STA) && (vap->iv_state == IEEE80211_S_RUN)) + if ((vap != NULL) && (vap->iv_opmode == IEEE80211_M_STA) && (vap->iv_state == IEEE80211_S_RUN)) htopmode = vap->iv_bss->ni_htopmode; else htopmode = ic->ic_curhtprotmode; -- 2.11.4.GIT