Skip to contentSkip to conversation

mac80211: check if key has TKIP type before updating IV

PATCH In review Stanislaw Gruszka 2 participants 2 messages Oct 2, 2012 – Oct 9, 2012 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: check if key has TKIP type before updating IV

This patch fix corruption which can manifest itself by following crash when switching on rfkill switch with rt2x00 driver:
https://bugzilla.redhat.com/attachment.cgi?id=615362

Pointer key->u.ccmp.tfm of group key get corrupted in:

ieee80211_rx_h_michael_mic_verify():

        /* update IV in key information to be able to detect replays */
        rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32;
        rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16;

because rt2x00 always set RX_FLAG_MMIC_STRIPPED, even if key is not TKIP.

We already check type of the key in different path in ieee80211_rx_h_michael_mic_verify() function, so adding additional check here is reasonable.

---
 net/mac80211/wpa.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/mac80211/wpa.c +2 -1
index bdb53ab..e72562a 100644
@@ -106,7 +106,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
 		if (status->flag & RX_FLAG_MMIC_ERROR)
 			goto mic_fail;
 
-		if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key)
+		if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
+		    rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
 			goto update_iv;
 
 		return RX_CONTINUE;
Signature · 1 line
1.7.1
maintainer
#1 lore raw
Quoted 12 lines · Stanislaw Gruszka

This patch fix corruption which can manifest itself by following crash when switching on rfkill switch with rt2x00 driver:
https://bugzilla.redhat.com/attachment.cgi?id=615362

Pointer key->u.ccmp.tfm of group key get corrupted in:

ieee80211_rx_h_michael_mic_verify():

        /* update IV in key information to be able to detect replays */
        rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32;
        rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16;
Quoted 8 lines

because rt2x00 always set RX_FLAG_MMIC_STRIPPED, even if key is not TKIP.

We already check type of the key in different path in ieee80211_rx_h_michael_mic_verify() function, so adding additional check here is reasonable.

Looks fine, John, could you also pick this up for 3.7?

johannes