aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00queue.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-08-29 15:04:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:11 -0400
commit0262ab0df64a67d4c0ed7577a29b7d866819cc68 (patch)
tree95c5e7842787c60140fe6c35ff7a1bc8b43bebaf /drivers/net/wireless/rt2x00/rt2x00queue.c
parentde9cc7a4e6f975ca5e91cf8745b3e35a7e780bae (diff)
rt2x00: Fix race conditions in flag handling
Some of the flags should be accessed atomically to prevent race conditions. The flags that are most important are those that can change often and indicate the actual state of the device, queue or queue entry. The big flag rename was done to move all state flags to the same naming type as the other rt2x00dev flags and made sure all places where the flags were used were changed. ;) Thanks to Stephen for most of the queue flags updates, which fixes some of the most obvious consequences of the race conditions. Among those the notorious: rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0. rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0. rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0. Signed-off-by: Stephen Blackheath <tramp.enshrine.stephen@blacksapphire.com> 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/rt2x00queue.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index c0f97c53e5ce..d10a8012f387 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -356,7 +356,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
356 if (unlikely(rt2x00queue_full(queue))) 356 if (unlikely(rt2x00queue_full(queue)))
357 return -EINVAL; 357 return -EINVAL;
358 358
359 if (__test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) { 359 if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) {
360 ERROR(queue->rt2x00dev, 360 ERROR(queue->rt2x00dev,
361 "Arrived at non-free entry in the non-full queue %d.\n" 361 "Arrived at non-free entry in the non-full queue %d.\n"
362 "Please file bug report to %s.\n", 362 "Please file bug report to %s.\n",
@@ -396,7 +396,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
396 * the frame to mac80211 because the skb->cb has now been tainted. 396 * the frame to mac80211 because the skb->cb has now been tainted.
397 */ 397 */
398 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { 398 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) {
399 __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 399 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
400 dev_kfree_skb_any(entry->skb); 400 dev_kfree_skb_any(entry->skb);
401 entry->skb = NULL; 401 entry->skb = NULL;
402 return 0; 402 return 0;
@@ -405,7 +405,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
405 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags)) 405 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
406 rt2x00queue_map_txskb(queue->rt2x00dev, skb); 406 rt2x00queue_map_txskb(queue->rt2x00dev, skb);
407 407
408 __set_bit(ENTRY_DATA_PENDING, &entry->flags); 408 set_bit(ENTRY_DATA_PENDING, &entry->flags);
409 409
410 rt2x00queue_index_inc(queue, Q_INDEX); 410 rt2x00queue_index_inc(queue, Q_INDEX);
411 rt2x00queue_write_tx_descriptor(entry, &txdesc); 411 rt2x00queue_write_tx_descriptor(entry, &txdesc);