diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-01-06 17:40:27 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-01-10 16:18:25 -0500 |
commit | c5d0dc5f0dd66770232d7d360c770d2344b76d52 (patch) | |
tree | 8a0347ce38d9132f2bd839425d5984a8540ca2cd /drivers/net/wireless/rt2x00/rt2x00usb.c | |
parent | dd87145d2c3a7b1c8b338e1f6e174b3d2a17cd35 (diff) |
rt2x00: Put 802.11 data on 4 byte boundary
Check the size of the ieee80211 header during rxdone
and make sure the data behind the ieee80211 header
is placed on a 4 byte boundary.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 1f5675dd329f..ab4797ed94c9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
221 | struct data_ring *ring = entry->ring; | 221 | struct data_ring *ring = entry->ring; |
222 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; | 222 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; |
223 | struct sk_buff *skb; | 223 | struct sk_buff *skb; |
224 | struct ieee80211_hdr *hdr; | ||
224 | struct rxdata_entry_desc desc; | 225 | struct rxdata_entry_desc desc; |
226 | int header_size; | ||
225 | int frame_size; | 227 | int frame_size; |
226 | 228 | ||
227 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 229 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
@@ -253,9 +255,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
253 | skb_put(skb, frame_size); | 255 | skb_put(skb, frame_size); |
254 | 256 | ||
255 | /* | 257 | /* |
256 | * Trim the skb_buffer to only contain the valid | 258 | * The data behind the ieee80211 header must be |
257 | * frame data (so ignore the device's descriptor). | 259 | * aligned on a 4 byte boundary. |
260 | * After that trim the entire buffer down to only | ||
261 | * contain the valid frame data excluding the device | ||
262 | * descriptor. | ||
258 | */ | 263 | */ |
264 | hdr = (struct ieee80211_hdr *)entry->skb->data; | ||
265 | header_size = | ||
266 | ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); | ||
267 | |||
268 | if (header_size % 4 == 0) { | ||
269 | skb_push(entry->skb, 2); | ||
270 | memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2); | ||
271 | } | ||
259 | skb_trim(entry->skb, desc.size); | 272 | skb_trim(entry->skb, desc.size); |
260 | 273 | ||
261 | /* | 274 | /* |