diff options
Diffstat (limited to 'net/ieee80211/ieee80211_tx.c')
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index de148ae594f3..bf042139c7ab 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -562,10 +562,13 @@ int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
562 | struct net_device_stats *stats = &ieee->stats; | 562 | struct net_device_stats *stats = &ieee->stats; |
563 | struct sk_buff *skb_frag; | 563 | struct sk_buff *skb_frag; |
564 | int priority = -1; | 564 | int priority = -1; |
565 | int fraglen = total_len; | ||
566 | int headroom = ieee->tx_headroom; | ||
567 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; | ||
565 | 568 | ||
566 | spin_lock_irqsave(&ieee->lock, flags); | 569 | spin_lock_irqsave(&ieee->lock, flags); |
567 | 570 | ||
568 | if (encrypt_mpdu && !ieee->sec.encrypt) | 571 | if (encrypt_mpdu && (!ieee->sec.encrypt || !crypt)) |
569 | encrypt_mpdu = 0; | 572 | encrypt_mpdu = 0; |
570 | 573 | ||
571 | /* If there is no driver handler to take the TXB, dont' bother | 574 | /* If there is no driver handler to take the TXB, dont' bother |
@@ -581,20 +584,24 @@ int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
581 | goto success; | 584 | goto success; |
582 | } | 585 | } |
583 | 586 | ||
584 | if (encrypt_mpdu) | 587 | if (encrypt_mpdu) { |
585 | frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 588 | frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
589 | fraglen += crypt->ops->extra_mpdu_prefix_len + | ||
590 | crypt->ops->extra_mpdu_postfix_len; | ||
591 | headroom += crypt->ops->extra_mpdu_prefix_len; | ||
592 | } | ||
586 | 593 | ||
587 | /* When we allocate the TXB we allocate enough space for the reserve | 594 | /* When we allocate the TXB we allocate enough space for the reserve |
588 | * and full fragment bytes (bytes_per_frag doesn't include prefix, | 595 | * and full fragment bytes (bytes_per_frag doesn't include prefix, |
589 | * postfix, header, FCS, etc.) */ | 596 | * postfix, header, FCS, etc.) */ |
590 | txb = ieee80211_alloc_txb(1, total_len, ieee->tx_headroom, GFP_ATOMIC); | 597 | txb = ieee80211_alloc_txb(1, fraglen, headroom, GFP_ATOMIC); |
591 | if (unlikely(!txb)) { | 598 | if (unlikely(!txb)) { |
592 | printk(KERN_WARNING "%s: Could not allocate TXB\n", | 599 | printk(KERN_WARNING "%s: Could not allocate TXB\n", |
593 | ieee->dev->name); | 600 | ieee->dev->name); |
594 | goto failed; | 601 | goto failed; |
595 | } | 602 | } |
596 | txb->encrypted = 0; | 603 | txb->encrypted = 0; |
597 | txb->payload_size = total_len; | 604 | txb->payload_size = fraglen; |
598 | 605 | ||
599 | skb_frag = txb->fragments[0]; | 606 | skb_frag = txb->fragments[0]; |
600 | 607 | ||