diff options
Diffstat (limited to 'net/mac80211/wep.c')
-rw-r--r-- | net/mac80211/wep.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index 3cbae42ec504..e7b6344c900a 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -93,13 +93,9 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, | |||
93 | fc |= IEEE80211_FCTL_PROTECTED; | 93 | fc |= IEEE80211_FCTL_PROTECTED; |
94 | hdr->frame_control = cpu_to_le16(fc); | 94 | hdr->frame_control = cpu_to_le16(fc); |
95 | 95 | ||
96 | if ((skb_headroom(skb) < WEP_IV_LEN || | 96 | if (WARN_ON(skb_tailroom(skb) < WEP_ICV_LEN || |
97 | skb_tailroom(skb) < WEP_ICV_LEN)) { | 97 | skb_headroom(skb) < WEP_IV_LEN)) |
98 | I802_DEBUG_INC(local->tx_expand_skb_head); | 98 | return NULL; |
99 | if (unlikely(pskb_expand_head(skb, WEP_IV_LEN, WEP_ICV_LEN, | ||
100 | GFP_ATOMIC))) | ||
101 | return NULL; | ||
102 | } | ||
103 | 99 | ||
104 | hdrlen = ieee80211_get_hdrlen(fc); | 100 | hdrlen = ieee80211_get_hdrlen(fc); |
105 | newhdr = skb_push(skb, WEP_IV_LEN); | 101 | newhdr = skb_push(skb, WEP_IV_LEN); |
@@ -333,11 +329,16 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) | |||
333 | 329 | ||
334 | static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | 330 | static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) |
335 | { | 331 | { |
332 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
333 | |||
334 | info->control.iv_len = WEP_IV_LEN; | ||
335 | info->control.icv_len = WEP_ICV_LEN; | ||
336 | |||
336 | if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { | 337 | if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { |
337 | if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) | 338 | if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) |
338 | return -1; | 339 | return -1; |
339 | } else { | 340 | } else { |
340 | tx->control->hw_key = &tx->key->conf; | 341 | info->control.hw_key = &tx->key->conf; |
341 | if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { | 342 | if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { |
342 | if (!ieee80211_wep_add_iv(tx->local, skb, tx->key)) | 343 | if (!ieee80211_wep_add_iv(tx->local, skb, tx->key)) |
343 | return -1; | 344 | return -1; |
@@ -349,8 +350,6 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
349 | ieee80211_tx_result | 350 | ieee80211_tx_result |
350 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) | 351 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) |
351 | { | 352 | { |
352 | tx->control->iv_len = WEP_IV_LEN; | ||
353 | tx->control->icv_len = WEP_ICV_LEN; | ||
354 | ieee80211_tx_set_protected(tx); | 353 | ieee80211_tx_set_protected(tx); |
355 | 354 | ||
356 | if (wep_encrypt_skb(tx, tx->skb) < 0) { | 355 | if (wep_encrypt_skb(tx, tx->skb) < 0) { |