From: Jouni Malinen Date: Thu, 18 Dec 2008 12:33:00 +0000 (+0200) Subject: ath9k: Fixed RX decryption status reporting X-Git-Tag: v2.6.29-rc1~581^2~105^2~8 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=be2864cfff2fe4b599b46f03cce1e7689e05c60c;p=~shefty%2Frdma-dev.git ath9k: Fixed RX decryption status reporting The RX code in ath9k uses sc_keymap to figure out whether a default key was used. However, the default key entries in sc_keymap were always set and as such, frames could have been claimed to be decrypted by hardware when they were not. This can cause problems especially with TKIP since mac80211 is validating the Michael MIC in the frame and this will result in MIC failure and potentially TKIP countermeasures if the frame was not decrypted correctly. Change key cache slot allocation to mark only the keys that really have been used in sc_keymap to avoid the issue. The key cache slot selection routines are now internally avoiding the slots that may be needed for TKIP group keys. Signed-off-by: Jouni Malinen Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index b44736782ab..191eec50dc7 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c @@ -776,6 +776,18 @@ static int ath_reserve_key_cache_slot(struct ath_softc *sc) /* No partially used TKIP slots, pick any available slot */ for (i = IEEE80211_WEP_NKID; i < sc->sc_keymax; i++) { + /* Do not allow slots that could be needed for TKIP group keys + * to be used. This limitation could be removed if we know that + * TKIP will not be used. */ + if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) + continue; + if (sc->sc_splitmic) { + if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) + continue; + if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) + continue; + } + if (!test_bit(i, sc->sc_keymap)) return i; /* Found a free slot for a key */ } @@ -1361,20 +1373,6 @@ static int ath_init(u16 devid, struct ath_softc *sc) */ for (i = 0; i < sc->sc_keymax; i++) ath9k_hw_keyreset(ah, (u16) i); - /* - * Mark key cache slots associated with global keys - * as in use. If we knew TKIP was not to be used we - * could leave the +32, +64, and +32+64 slots free. - */ - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - set_bit(i, sc->sc_keymap); - set_bit(i + 64, sc->sc_keymap); - if (ath9k_hw_getcapability(ah, ATH9K_CAP_TKIP_SPLIT, - 0, NULL)) { - set_bit(i + 32, sc->sc_keymap); - set_bit(i + 32 + 64, sc->sc_keymap); - } - } /* Collect the channel list using the default country code */