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 <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Jouni Malinen 2008-12-18 14:33:00 +02:00 committed by John W. Linville
parent ea61213288
commit be2864cfff
1 changed files with 12 additions and 14 deletions

View File

@ -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 */