rt2x00: Properly reserve room for descriptors in skbs.
Instead of fiddling with the skb->data pointer and thereby risking out of bounds accesses, properly reserve the space needed in an skb for descriptors. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
This commit is contained in:
committed by
Ivo van Doorn
parent
baaffe67b5
commit
0b8004aa12
@@ -1442,7 +1442,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
|
||||
struct txentry_desc *txdesc)
|
||||
{
|
||||
struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
|
||||
__le32 *txd = (__le32 *)(skb->data - TXD_DESC_SIZE);
|
||||
__le32 *txd = (__le32 *) skb->data;
|
||||
u32 word;
|
||||
|
||||
/*
|
||||
@@ -1505,6 +1505,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
|
||||
/*
|
||||
* Register descriptor details in skb frame descriptor.
|
||||
*/
|
||||
skbdesc->flags |= SKBDESC_DESC_IN_SKB;
|
||||
skbdesc->desc = txd;
|
||||
skbdesc->desc_len = TXD_DESC_SIZE;
|
||||
}
|
||||
@@ -1527,6 +1528,12 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
|
||||
rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0);
|
||||
rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
|
||||
|
||||
/*
|
||||
* Add space for the descriptor in front of the skb.
|
||||
*/
|
||||
skb_push(entry->skb, TXD_DESC_SIZE);
|
||||
memset(entry->skb->data, 0, TXD_DESC_SIZE);
|
||||
|
||||
/*
|
||||
* Write the TX descriptor for the beacon.
|
||||
*/
|
||||
@@ -1537,11 +1544,6 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
|
||||
*/
|
||||
rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
|
||||
|
||||
/*
|
||||
* Take the descriptor in front of the skb into account.
|
||||
*/
|
||||
skb_push(entry->skb, TXD_DESC_SIZE);
|
||||
|
||||
/*
|
||||
* Write entire beacon with descriptor to register.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user