diff options
author | Christian Lamparter <chunkeey@web.de> | 2009-03-30 09:55:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-16 10:39:06 -0400 |
commit | 731c6531684250c46d732e369b25b003356f3947 (patch) | |
tree | 2f6b7f210fea5c093ba0cbb3e592557942aeb4e6 /drivers/net/wireless | |
parent | 540828196e48ec54b64067a2b9defd870bff3ece (diff) |
p54spi: fix locking warning in p54spi_op_tx
This patch fixes the following waring:
> ------------[ cut here ]------------
>WARNING: at kernel/softirq.c:138 local_bh_enable+0x54/0xbc()
>Modules linked in: p54spi
>[<c0034ff8>] (dump_stack+0x0/0x14)
>[<c005b1a4>] (warn_on_slowpath+0x0/0x68)
>[<c00604c8>] (local_bh_enable+0x0/0xbc)
>[<bf000000>] (p54spi_op_tx+0x0/0x4c [p54spi])
>[<c01a4d34>] (p54_sta_unlock+0x0/0x78)
p54spi_op_tx needs to be called from different locking contexts.
Therefore we have to protect the linked list with irqsave spinlocks.
Reported-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/p54/p54spi.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index 2b222aaa6f0a..d1fe577de3d4 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -457,9 +457,10 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
457 | struct ieee80211_tx_info *info; | 457 | struct ieee80211_tx_info *info; |
458 | struct p54_tx_info *minfo; | 458 | struct p54_tx_info *minfo; |
459 | struct p54s_tx_info *dinfo; | 459 | struct p54s_tx_info *dinfo; |
460 | unsigned long flags; | ||
460 | int ret = 0; | 461 | int ret = 0; |
461 | 462 | ||
462 | spin_lock_bh(&priv->tx_lock); | 463 | spin_lock_irqsave(&priv->tx_lock, flags); |
463 | 464 | ||
464 | while (!list_empty(&priv->tx_pending)) { | 465 | while (!list_empty(&priv->tx_pending)) { |
465 | entry = list_entry(priv->tx_pending.next, | 466 | entry = list_entry(priv->tx_pending.next, |
@@ -467,7 +468,7 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
467 | 468 | ||
468 | list_del_init(&entry->tx_list); | 469 | list_del_init(&entry->tx_list); |
469 | 470 | ||
470 | spin_unlock_bh(&priv->tx_lock); | 471 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
471 | 472 | ||
472 | dinfo = container_of((void *) entry, struct p54s_tx_info, | 473 | dinfo = container_of((void *) entry, struct p54s_tx_info, |
473 | tx_list); | 474 | tx_list); |
@@ -479,16 +480,14 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
479 | 480 | ||
480 | ret = p54spi_tx_frame(priv, skb); | 481 | ret = p54spi_tx_frame(priv, skb); |
481 | 482 | ||
482 | spin_lock_bh(&priv->tx_lock); | ||
483 | |||
484 | if (ret < 0) { | 483 | if (ret < 0) { |
485 | p54_free_skb(priv->hw, skb); | 484 | p54_free_skb(priv->hw, skb); |
486 | goto out; | 485 | return ret; |
487 | } | 486 | } |
488 | } | ||
489 | 487 | ||
490 | out: | 488 | spin_lock_irqsave(&priv->tx_lock, flags); |
491 | spin_unlock_bh(&priv->tx_lock); | 489 | } |
490 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
492 | return ret; | 491 | return ret; |
493 | } | 492 | } |
494 | 493 | ||
@@ -498,12 +497,13 @@ static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
498 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 497 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
499 | struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; | 498 | struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; |
500 | struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; | 499 | struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; |
500 | unsigned long flags; | ||
501 | 501 | ||
502 | BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); | 502 | BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); |
503 | 503 | ||
504 | spin_lock_bh(&priv->tx_lock); | 504 | spin_lock_irqsave(&priv->tx_lock, flags); |
505 | list_add_tail(&di->tx_list, &priv->tx_pending); | 505 | list_add_tail(&di->tx_list, &priv->tx_pending); |
506 | spin_unlock_bh(&priv->tx_lock); | 506 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
507 | 507 | ||
508 | queue_work(priv->hw->workqueue, &priv->work); | 508 | queue_work(priv->hw->workqueue, &priv->work); |
509 | } | 509 | } |
@@ -604,6 +604,7 @@ out: | |||
604 | static void p54spi_op_stop(struct ieee80211_hw *dev) | 604 | static void p54spi_op_stop(struct ieee80211_hw *dev) |
605 | { | 605 | { |
606 | struct p54s_priv *priv = dev->priv; | 606 | struct p54s_priv *priv = dev->priv; |
607 | unsigned long flags; | ||
607 | 608 | ||
608 | if (mutex_lock_interruptible(&priv->mutex)) { | 609 | if (mutex_lock_interruptible(&priv->mutex)) { |
609 | /* FIXME: how to handle this error? */ | 610 | /* FIXME: how to handle this error? */ |
@@ -615,9 +616,9 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
615 | cancel_work_sync(&priv->work); | 616 | cancel_work_sync(&priv->work); |
616 | 617 | ||
617 | p54spi_power_off(priv); | 618 | p54spi_power_off(priv); |
618 | spin_lock_bh(&priv->tx_lock); | 619 | spin_lock_irqsave(&priv->tx_lock, flags); |
619 | INIT_LIST_HEAD(&priv->tx_pending); | 620 | INIT_LIST_HEAD(&priv->tx_pending); |
620 | spin_unlock_bh(&priv->tx_lock); | 621 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
621 | 622 | ||
622 | priv->fw_state = FW_STATE_OFF; | 623 | priv->fw_state = FW_STATE_OFF; |
623 | mutex_unlock(&priv->mutex); | 624 | mutex_unlock(&priv->mutex); |