diff options
author | Ismael Luceno <ismael.luceno@gmail.com> | 2010-12-27 09:06:17 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-04 14:35:14 -0500 |
commit | 11f16aefcc07178972f149f1a1d53e6868481394 (patch) | |
tree | 33944c9e2886172b0a31844473373cdc1ebe607e /drivers/net/wireless | |
parent | 736e3acadce8438e610b897af2b1c472ed58444b (diff) |
rt2x00: Fix panic on frame padding for rt2800 usb devices
Backtrace:
rt2800usb_write_tx_data
rt2x00queue_write_tx_frame
rt2x00mac_tx
invoke_tx_handlers
__ieee80211_tx
ieee80211_tx
virt_to_head_page
ieee80211_xmit
ieee80211_tx_skb
ieee80211_scan_work
schedule
ieee80211_scan_work
process_one_work
...
It tried to expand the skb past it's end using skb_put. So I replaced it
with a call to skb_padto, which takes the issue into account.
Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 3e0205ddf7b4..b97a4a54ff4c 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -369,7 +369,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, | |||
369 | static void rt2800usb_write_tx_data(struct queue_entry *entry, | 369 | static void rt2800usb_write_tx_data(struct queue_entry *entry, |
370 | struct txentry_desc *txdesc) | 370 | struct txentry_desc *txdesc) |
371 | { | 371 | { |
372 | u8 padding_len; | 372 | unsigned int len; |
373 | int err; | ||
374 | |||
375 | rt2800_write_tx_data(entry, txdesc); | ||
373 | 376 | ||
374 | /* | 377 | /* |
375 | * pad(1~3 bytes) is added after each 802.11 payload. | 378 | * pad(1~3 bytes) is added after each 802.11 payload. |
@@ -378,9 +381,14 @@ static void rt2800usb_write_tx_data(struct queue_entry *entry, | |||
378 | * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | | 381 | * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | |
379 | * |<------------- tx_pkt_len ------------->| | 382 | * |<------------- tx_pkt_len ------------->| |
380 | */ | 383 | */ |
381 | rt2800_write_tx_data(entry, txdesc); | 384 | len = roundup(entry->skb->len, 4) + 4; |
382 | padding_len = roundup(entry->skb->len + 4, 4) - entry->skb->len; | 385 | err = skb_padto(entry->skb, len); |
383 | memset(skb_put(entry->skb, padding_len), 0, padding_len); | 386 | if (unlikely(err)) { |
387 | WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n"); | ||
388 | return; | ||
389 | } | ||
390 | |||
391 | entry->skb->len = len; | ||
384 | } | 392 | } |
385 | 393 | ||
386 | /* | 394 | /* |