aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorMattias Nissler <mattias.nissler@gmx.de>2008-03-09 17:41:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-13 16:02:34 -0400
commit2ae23854dc0af617d9a0e3ab51a0cc51485ebbf2 (patch)
tree34f8ff7f1724a9aaaa3c6c0d048e483529f00df6 /drivers/net/wireless/rt2x00
parent2d1be5b0d17134ddba65c752557b1f47c8009db2 (diff)
rt2x00: Don't use unitialized rxdesc->size
rxdesc->size is unitialized before the desriptor has been read. Move the truncation of the sk buffer to the moment all variables have been initialized. Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de> 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')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 86cd9a5eee2b..559131fc6d53 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1123,13 +1123,10 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1123 1123
1124 /* 1124 /*
1125 * Copy descriptor to the available headroom inside the skbuffer. 1125 * Copy descriptor to the available headroom inside the skbuffer.
1126 * Remove the original copy by trimming the skbuffer.
1127 */ 1126 */
1128 skb_push(entry->skb, offset); 1127 skb_push(entry->skb, offset);
1129 memcpy(entry->skb->data, rxd, entry->queue->desc_size); 1128 memcpy(entry->skb->data, rxd, entry->queue->desc_size);
1130 rxd = (__le32 *)entry->skb->data; 1129 rxd = (__le32 *)entry->skb->data;
1131 skb_pull(entry->skb, offset);
1132 skb_trim(entry->skb, rxdesc->size);
1133 1130
1134 /* 1131 /*
1135 * The descriptor is now aligned to 4 bytes and thus it is 1132 * The descriptor is now aligned to 4 bytes and thus it is
@@ -1155,11 +1152,17 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1155 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1152 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1156 1153
1157 /* 1154 /*
1155 * Adjust the skb memory window to the frame boundaries.
1156 */
1157 skb_pull(entry->skb, offset);
1158 skb_trim(entry->skb, rxdesc->size);
1159
1160 /*
1158 * Set descriptor and data pointer. 1161 * Set descriptor and data pointer.
1159 */ 1162 */
1160 skbdesc->data = entry->skb->data; 1163 skbdesc->data = entry->skb->data;
1161 skbdesc->data_len = rxdesc->size; 1164 skbdesc->data_len = rxdesc->size;
1162 skbdesc->desc = entry->skb->data - offset; 1165 skbdesc->desc = rxd;
1163 skbdesc->desc_len = entry->queue->desc_size; 1166 skbdesc->desc_len = entry->queue->desc_size;
1164} 1167}
1165 1168
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index a48c82f09216..468039f1bff9 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1376,13 +1376,10 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
1376 1376
1377 /* 1377 /*
1378 * Copy descriptor to the available headroom inside the skbuffer. 1378 * Copy descriptor to the available headroom inside the skbuffer.
1379 * Remove the original copy by pulling the skbuffer.
1380 */ 1379 */
1381 skb_push(entry->skb, offset); 1380 skb_push(entry->skb, offset);
1382 memcpy(entry->skb->data, rxd, entry->queue->desc_size); 1381 memcpy(entry->skb->data, rxd, entry->queue->desc_size);
1383 rxd = (__le32 *)entry->skb->data; 1382 rxd = (__le32 *)entry->skb->data;
1384 skb_pull(entry->skb, offset + entry->queue->desc_size);
1385 skb_trim(entry->skb, rxdesc->size);
1386 1383
1387 /* 1384 /*
1388 * The descriptor is now aligned to 4 bytes and thus it is 1385 * The descriptor is now aligned to 4 bytes and thus it is
@@ -1405,11 +1402,17 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
1405 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1402 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1406 1403
1407 /* 1404 /*
1405 * Adjust the skb memory window to the frame boundaries.
1406 */
1407 skb_pull(entry->skb, offset + entry->queue->desc_size);
1408 skb_trim(entry->skb, rxdesc->size);
1409
1410 /*
1408 * Set descriptor and data pointer. 1411 * Set descriptor and data pointer.
1409 */ 1412 */
1410 skbdesc->data = entry->skb->data; 1413 skbdesc->data = entry->skb->data;
1411 skbdesc->data_len = rxdesc->size; 1414 skbdesc->data_len = rxdesc->size;
1412 skbdesc->desc = entry->skb->data - offset; 1415 skbdesc->desc = rxd;
1413 skbdesc->desc_len = entry->queue->desc_size; 1416 skbdesc->desc_len = entry->queue->desc_size;
1414} 1417}
1415 1418