From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: [PATCH 06/10] rt2x00: Fix panic on frame padding for rt2800 usb devices
Date: Mon, 27 Dec 2010 15:06:17 +0100 [thread overview]
Message-ID: <201012271506.18101.IvDoorn@gmail.com> (raw)
In-Reply-To: <201012271505.56572.IvDoorn@gmail.com>
From: Ismael Luceno <ismael.luceno@gmail.com>
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>
---
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 3e0205d..b97a4a5 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,
static void rt2800usb_write_tx_data(struct queue_entry *entry,
struct txentry_desc *txdesc)
{
- u8 padding_len;
+ unsigned int len;
+ int err;
+
+ rt2800_write_tx_data(entry, txdesc);
/*
* 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,
* | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad |
* |<------------- tx_pkt_len ------------->|
*/
- rt2800_write_tx_data(entry, txdesc);
- padding_len = roundup(entry->skb->len + 4, 4) - entry->skb->len;
- memset(skb_put(entry->skb, padding_len), 0, padding_len);
+ len = roundup(entry->skb->len, 4) + 4;
+ err = skb_padto(entry->skb, len);
+ if (unlikely(err)) {
+ WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n");
+ return;
+ }
+
+ entry->skb->len = len;
}
/*
--
1.7.2.3
next prev parent reply other threads:[~2010-12-27 14:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-27 14:04 [PATCH 01/10] rt2x00: simplify txstatus_fifo handling Ivo van Doorn
2010-12-27 14:04 ` [PATCH 02/10] rt2x00: allow txstatus_fifo w/o txstatus_tasklet Ivo van Doorn
2010-12-27 14:05 ` [PATCH 03/10] rt2x00: Remove intf->bssid field Ivo van Doorn
2010-12-27 14:05 ` [PATCH 04/10] rt2x00: remove intf->mac field Ivo van Doorn
2010-12-27 14:05 ` [PATCH 05/10] rt2x00: Fix pointer errors Ivo van Doorn
2010-12-27 14:06 ` Ivo van Doorn [this message]
2010-12-27 14:06 ` [PATCH 07/10] rt2x00: Remove superfluous assignment of mpdu_density Ivo van Doorn
2010-12-27 14:06 ` [PATCH 08/10] rt2x00: Simplify intf->delayed_flags locking Ivo van Doorn
2010-12-27 14:07 ` [PATCH 09/10] rt2x00: Remove unused interface spinlock Ivo van Doorn
2010-12-27 14:07 ` [PATCH 10/10] rt2x00: Fix comment about removed spinlock Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201012271506.18101.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=users@rt2x00.serialmonkey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).