* [patch] ieee80211: fix not allocating IV+ICV space when using encryption in ieee80211_tx_frame
@ 2006-06-20 2:26 Hong Liu
2006-06-21 3:35 ` [patch] ieee80211: fix not allocating IV+ICV space when usingencryption " Hong Liu
0 siblings, 1 reply; 2+ messages in thread
From: Hong Liu @ 2006-06-20 2:26 UTC (permalink / raw)
To: linville; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
We should preallocate IV+ICV space when encrypting the frame.
Currently no problem shows up just because dev_alloc_skb aligns the
data len to SMP_CACHE_BYTES which can be used for ICV.
Thanks,
Hong
[-- Attachment #2: ieee80211-1.1.14-newtxfix.patch --]
[-- Type: text/x-patch, Size: 1620 bytes --]
diff -urp a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
--- a/net/ieee80211/ieee80211_tx.c 2006-06-20 09:36:13.000000000 +0800
+++ b/net/ieee80211/ieee80211_tx.c 2006-06-20 09:32:39.000000000 +0800
@@ -562,10 +562,12 @@ int ieee80211_tx_frame(struct ieee80211_
struct net_device_stats *stats = &ieee->stats;
struct sk_buff *skb_frag;
int priority = -1;
+ int fraglen = total_len;
+ struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
spin_lock_irqsave(&ieee->lock, flags);
- if (encrypt_mpdu && !ieee->sec.encrypt)
+ if (encrypt_mpdu && (!ieee->sec.encrypt || !crypt))
encrypt_mpdu = 0;
/* If there is no driver handler to take the TXB, dont' bother
@@ -581,20 +583,25 @@ int ieee80211_tx_frame(struct ieee80211_
goto success;
}
- if (encrypt_mpdu)
+ if (encrypt_mpdu) {
frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
+ /* mpdu_prefix_len will be add to the headroom */
+ fraglen += crypt->ops->extra_mpdu_postfix_len;
+ }
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(1, total_len, ieee->tx_headroom, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb(1, fraglen, ieee->tx_headroom +
+ crypt->ops->extra_mpdu_prefix_len,
+ GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
txb->encrypted = 0;
- txb->payload_size = total_len;
+ txb->payload_size = fraglen;
skb_frag = txb->fragments[0];
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] ieee80211: fix not allocating IV+ICV space when usingencryption in ieee80211_tx_frame
2006-06-20 2:26 [patch] ieee80211: fix not allocating IV+ICV space when using encryption in ieee80211_tx_frame Hong Liu
@ 2006-06-21 3:35 ` Hong Liu
0 siblings, 0 replies; 2+ messages in thread
From: Hong Liu @ 2006-06-21 3:35 UTC (permalink / raw)
To: linville; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
On Tue, 2006-06-20 at 10:26, Hong Liu wrote:
> We should preallocate IV+ICV space when encrypting the frame.
> Currently no problem shows up just because dev_alloc_skb aligns the
> data len to SMP_CACHE_BYTES which can be used for ICV.
>
> Thanks,
> Hong
>
Please apply this new patch.
The previous patch has a problem when security is not set.
[-- Attachment #2: ieee80211-1.1.14-newtxfix.patch --]
[-- Type: text/x-patch, Size: 1637 bytes --]
diff -urp a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
--- a/net/ieee80211/ieee80211_tx.c 2006-06-20 09:36:13.000000000 +0800
+++ b/net/ieee80211/ieee80211_tx.c 2006-06-21 11:22:56.000000000 +0800
@@ -562,10 +562,13 @@ int ieee80211_tx_frame(struct ieee80211_
struct net_device_stats *stats = &ieee->stats;
struct sk_buff *skb_frag;
int priority = -1;
+ int fraglen = total_len;
+ int headroom = ieee->tx_headroom;
+ struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
spin_lock_irqsave(&ieee->lock, flags);
- if (encrypt_mpdu && !ieee->sec.encrypt)
+ if (encrypt_mpdu && (!ieee->sec.encrypt || !crypt))
encrypt_mpdu = 0;
/* If there is no driver handler to take the TXB, dont' bother
@@ -581,20 +584,24 @@ int ieee80211_tx_frame(struct ieee80211_
goto success;
}
- if (encrypt_mpdu)
+ if (encrypt_mpdu) {
frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
+ fraglen += crypt->ops->extra_mpdu_prefix_len +
+ crypt->ops->extra_mpdu_postfix_len;
+ headroom += crypt->ops->extra_mpdu_prefix_len;
+ }
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(1, total_len, ieee->tx_headroom, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb(1, fraglen, headroom, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
txb->encrypted = 0;
- txb->payload_size = total_len;
+ txb->payload_size = fraglen;
skb_frag = txb->fragments[0];
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-21 3:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-20 2:26 [patch] ieee80211: fix not allocating IV+ICV space when using encryption in ieee80211_tx_frame Hong Liu
2006-06-21 3:35 ` [patch] ieee80211: fix not allocating IV+ICV space when usingencryption " Hong Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).