aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/bcm43xx/bcm43xx_main.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2006-09-26 13:22:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-10-16 20:09:47 -0400
commit3693ec670b3bb4d11295856bea3592dd8f37f9a5 (patch)
tree3af120e21b4d693f8f48bf5d00a8b2872c4018b2 /drivers/net/wireless/bcm43xx/bcm43xx_main.c
parent51018b0a3160d253283173c2f54f16746cee5852 (diff)
downloadlinux-linaro-android-3693ec670b3bb4d11295856bea3592dd8f37f9a5.tar.gz
[PATCH] bcm43xx: fix race condition in periodic work handler
There is a potential race condition in the periodic_work_handler routine of bcm43xx-softmac. In addition to fixing this condition, the size of code is reduced by moving the mutex lock outside the if. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_main.c')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index bad3452ea89..0f047d42158 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -3164,12 +3164,12 @@ static void bcm43xx_periodic_work_handler(void *d)
u32 savedirqs = 0;
int badness;
+ mutex_lock(&bcm->mutex);
badness = estimate_periodic_work_badness(bcm->periodic_state);
if (badness > BADNESS_LIMIT) {
/* Periodic work will take a long time, so we want it to
* be preemtible.
*/
- mutex_lock(&bcm->mutex);
netif_tx_disable(bcm->net_dev);
spin_lock_irqsave(&bcm->irq_lock, flags);
bcm43xx_mac_suspend(bcm);
@@ -3182,7 +3182,6 @@ static void bcm43xx_periodic_work_handler(void *d)
/* Periodic work should take short time, so we want low
* locking overhead.
*/
- mutex_lock(&bcm->mutex);
spin_lock_irqsave(&bcm->irq_lock, flags);
}