mac80211: fix lockdep warning
[cascardo/linux.git] / net / mac80211 / wpa.c
index 8d59d27..bee230d 100644 (file)
@@ -36,8 +36,8 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
        int tail;
 
        hdr = (struct ieee80211_hdr *)skb->data;
-       if (!tx->key || tx->key->conf.alg != ALG_TKIP || skb->len < 24 ||
-           !ieee80211_is_data_present(hdr->frame_control))
+       if (!tx->key || tx->key->conf.cipher != WLAN_CIPHER_SUITE_TKIP ||
+           skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
                return TX_CONTINUE;
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -94,7 +94,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
        if (status->flag & RX_FLAG_MMIC_STRIPPED)
                return RX_CONTINUE;
 
-       if (!rx->key || rx->key->conf.alg != ALG_TKIP ||
+       if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_TKIP ||
            !ieee80211_has_protected(hdr->frame_control) ||
            !ieee80211_is_data_present(hdr->frame_control))
                return RX_CONTINUE;
@@ -117,7 +117,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
        key = &rx->key->conf.key[key_offset];
        michael_mic(key, hdr, data, data_len, mic);
        if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) {
-               if (!(rx->flags & IEEE80211_RX_RA_MATCH))
+               if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
                        return RX_DROP_UNUSABLE;
 
                mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx,
@@ -221,19 +221,13 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
        if (!rx->sta || skb->len - hdrlen < 12)
                return RX_DROP_UNUSABLE;
 
-       if (status->flag & RX_FLAG_DECRYPTED) {
-               if (status->flag & RX_FLAG_IV_STRIPPED) {
-                       /*
-                        * Hardware took care of all processing, including
-                        * replay protection, and stripped the ICV/IV so
-                        * we cannot do any checks here.
-                        */
-                       return RX_CONTINUE;
-               }
-
-               /* let TKIP code verify IV, but skip decryption */
+       /*
+        * Let TKIP code verify IV, but skip decryption.
+        * In the case where hardware checks the IV as well,
+        * we don't even get here, see ieee80211_rx_h_decrypt()
+        */
+       if (status->flag & RX_FLAG_DECRYPTED)
                hwaccel = 1;
-       }
 
        res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
                                          key, skb->data + hdrlen,
@@ -447,10 +441,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
        if (!rx->sta || data_len < 0)
                return RX_DROP_UNUSABLE;
 
-       if ((status->flag & RX_FLAG_DECRYPTED) &&
-           (status->flag & RX_FLAG_IV_STRIPPED))
-               return RX_CONTINUE;
-
        ccmp_hdr2pn(pn, skb->data + hdrlen);
 
        queue = ieee80211_is_mgmt(hdr->frame_control) ?
@@ -564,10 +554,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
        if (!ieee80211_is_mgmt(hdr->frame_control))
                return RX_CONTINUE;
 
-       if ((status->flag & RX_FLAG_DECRYPTED) &&
-           (status->flag & RX_FLAG_IV_STRIPPED))
-               return RX_CONTINUE;
-
        if (skb->len < 24 + sizeof(*mmie))
                return RX_DROP_UNUSABLE;