From d1da21d795e524d9648d307116bad8a08bf4a4aa Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Sat, 6 Mar 2010 13:52:50 +0100 Subject: [PATCH] Fixed several invalid VAP accesses --- rt2870.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rt2870.c b/rt2870.c index 2402d1b..9dfb985 100644 --- a/rt2870.c +++ b/rt2870.c @@ -3147,19 +3147,21 @@ static void rt2870_asic_update_rtsthreshold(struct rt2870_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; + RT2870_DPRINTF(sc, RT2870_DEBUG_PROT, "%s: updating RTS threshold: %d\n", - device_get_nameunit(sc->dev), vap->iv_rtsthreshold); + device_get_nameunit(sc->dev), threshold); tmp = rt2870_io_mac_read(sc, RT2870_REG_TX_RTS_CFG); tmp &= ~(RT2870_REG_TX_RTS_THRESHOLD_MASK << RT2870_REG_TX_RTS_THRESHOLD_SHIFT); - if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX) - threshold = 0x1000; - else - threshold = vap->iv_rtsthreshold; - tmp |= ((threshold & RT2870_REG_TX_RTS_THRESHOLD_MASK) << RT2870_REG_TX_RTS_THRESHOLD_SHIFT); @@ -3331,7 +3333,7 @@ static void rt2870_asic_updateprot(struct rt2870_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