diff options
author | Gertjan van Wingerde <gwingerde@kpnplanet.nl> | 2008-06-06 22:54:28 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:17:57 -0400 |
commit | a26cbc650846b74dd7f46dd877fd30c472df14a1 (patch) | |
tree | a31d96161b36ea6be4d84f1ad23c056f4b3323b7 /drivers/net/wireless/rt2x00/rt2x00usb.c | |
parent | 239c249d06b0c68ae06b10d9d6ad1f8e7f39452b (diff) |
rt2x00: Fix double usage of skb->cb in USB RX path.
It is not safe to use the skb->cb area for both the rxd and
skb_frame_desc data at the same time, while they occupy an overlapping
piece of memory. This can lead to hard to trace crashes as pointers
within skb_frame_desc are pointing into nowhere, or the rxd data is
overwritten with non-sense.
Fix it by copying the rxd to a small buffer on the stack.
Signed-off-by: Gertjan van Wingerde <gwingerde@kpnplanet.nl>
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 | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 33833bc6d66..68d87f09e05 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c @@ -267,6 +267,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) struct sk_buff *skb; struct skb_frame_desc *skbdesc; struct rxdone_entry_desc rxdesc; + u8 rxd[32]; if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || !test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) @@ -286,16 +287,13 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) skbdesc = get_skb_frame_desc(entry->skb); memset(skbdesc, 0, sizeof(*skbdesc)); skbdesc->entry = entry; + skbdesc->desc = rxd; + skbdesc->desc_len = entry->queue->desc_size; memset(&rxdesc, 0, sizeof(rxdesc)); rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); /* - * Trim the skb to the correct size. - */ - skb_trim(entry->skb, rxdesc.size); - - /* * Allocate a new sk buffer to replace the current one. * If allocation fails, we should drop the current frame * so we can recycle the existing sk buffer for the new frame. |