aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorIwo Mergler <iwo@call-direct.com.au>2008-07-19 10:17:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-29 16:55:05 -0400
commitb93ce437eba7e0232683326f30d9d1167a872fad (patch)
tree5f9a501d4407be45e7f3cab6312ae2e3c725278d /drivers/net/wireless
parent3e0c1abe748a30bc705a55f71bca8e04a83820f1 (diff)
rt2x00: Fix the beacon length bug
When setting up a beacon template, the length of the beacon is calculated with the assumption that the SKB already contains the Tx descriptor. In the case of beacons it doesn't. This patch undoes the damage by adding the Tx descriptor length to the beacon length. This is safe, because the shortest possible beacon is longer than the Tx header. Signed-off-by: Iwo Mergler <Iwo@call-direct.com.au> 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/rt2500usb.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c12
2 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 449c8d393484..3078417b326b 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1121,6 +1121,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1121 int pipe = usb_sndbulkpipe(usb_dev, 1); 1121 int pipe = usb_sndbulkpipe(usb_dev, 1);
1122 int length; 1122 int length;
1123 u16 reg; 1123 u16 reg;
1124 u32 word, len;
1124 1125
1125 /* 1126 /*
1126 * Add the descriptor in front of the skb. 1127 * Add the descriptor in front of the skb.
@@ -1130,6 +1131,17 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1130 skbdesc->desc = entry->skb->data; 1131 skbdesc->desc = entry->skb->data;
1131 1132
1132 /* 1133 /*
1134 * Adjust the beacon databyte count. The current number is
1135 * calculated before this function gets called, but falsely
1136 * assumes that the descriptor was already present in the SKB.
1137 */
1138 rt2x00_desc_read(skbdesc->desc, 0, &word);
1139 len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
1140 len += skbdesc->desc_len;
1141 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
1142 rt2x00_desc_write(skbdesc->desc, 0, word);
1143
1144 /*
1133 * Disable beaconing while we are reloading the beacon data, 1145 * Disable beaconing while we are reloading the beacon data,
1134 * otherwise we might be sending out invalid data. 1146 * otherwise we might be sending out invalid data.
1135 */ 1147 */
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index fc320c0409db..866504612e8a 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1330,6 +1330,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1330 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 1330 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1331 unsigned int beacon_base; 1331 unsigned int beacon_base;
1332 u32 reg; 1332 u32 reg;
1333 u32 word, len;
1333 1334
1334 /* 1335 /*
1335 * Add the descriptor in front of the skb. 1336 * Add the descriptor in front of the skb.
@@ -1339,6 +1340,17 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1339 skbdesc->desc = entry->skb->data; 1340 skbdesc->desc = entry->skb->data;
1340 1341
1341 /* 1342 /*
1343 * Adjust the beacon databyte count. The current number is
1344 * calculated before this function gets called, but falsely
1345 * assumes that the descriptor was already present in the SKB.
1346 */
1347 rt2x00_desc_read(skbdesc->desc, 0, &word);
1348 len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
1349 len += skbdesc->desc_len;
1350 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
1351 rt2x00_desc_write(skbdesc->desc, 0, word);
1352
1353 /*
1342 * Disable beaconing while we are reloading the beacon data, 1354 * Disable beaconing while we are reloading the beacon data,
1343 * otherwise we might be sending out invalid data. 1355 * otherwise we might be sending out invalid data.
1344 */ 1356 */