diff options
-rw-r--r-- | net/mac80211/wpa.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 58d0b258b684..5dd48f0a4b1b 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -1175,7 +1175,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) | |||
1175 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 1175 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
1176 | struct ieee80211_key *key = rx->key; | 1176 | struct ieee80211_key *key = rx->key; |
1177 | struct ieee80211_mmie_16 *mmie; | 1177 | struct ieee80211_mmie_16 *mmie; |
1178 | u8 aad[GMAC_AAD_LEN], mic[GMAC_MIC_LEN], ipn[6], nonce[GMAC_NONCE_LEN]; | 1178 | u8 aad[GMAC_AAD_LEN], *mic, ipn[6], nonce[GMAC_NONCE_LEN]; |
1179 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1179 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1180 | 1180 | ||
1181 | if (!ieee80211_is_mgmt(hdr->frame_control)) | 1181 | if (!ieee80211_is_mgmt(hdr->frame_control)) |
@@ -1206,13 +1206,18 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) | |||
1206 | memcpy(nonce, hdr->addr2, ETH_ALEN); | 1206 | memcpy(nonce, hdr->addr2, ETH_ALEN); |
1207 | memcpy(nonce + ETH_ALEN, ipn, 6); | 1207 | memcpy(nonce + ETH_ALEN, ipn, 6); |
1208 | 1208 | ||
1209 | mic = kmalloc(GMAC_MIC_LEN, GFP_ATOMIC); | ||
1210 | if (!mic) | ||
1211 | return RX_DROP_UNUSABLE; | ||
1209 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, | 1212 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, |
1210 | skb->data + 24, skb->len - 24, | 1213 | skb->data + 24, skb->len - 24, |
1211 | mic) < 0 || | 1214 | mic) < 0 || |
1212 | crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | 1215 | crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { |
1213 | key->u.aes_gmac.icverrors++; | 1216 | key->u.aes_gmac.icverrors++; |
1217 | kfree(mic); | ||
1214 | return RX_DROP_UNUSABLE; | 1218 | return RX_DROP_UNUSABLE; |
1215 | } | 1219 | } |
1220 | kfree(mic); | ||
1216 | } | 1221 | } |
1217 | 1222 | ||
1218 | memcpy(key->u.aes_gmac.rx_pn, ipn, 6); | 1223 | memcpy(key->u.aes_gmac.rx_pn, ipn, 6); |