linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b43: fix shared IRQ race condition
@ 2007-11-07 17:16 Stefano Brivio
  2007-11-07 17:31 ` Michael Buesch
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2007-11-07 17:16 UTC (permalink / raw)
  To: John W. Linville, Michael Buesch; +Cc: linux-wireless, bcm43xx-dev

Fix an IRQ race condition in b43. If we call b43_stop_wireless_core(), it
will set the status of the device to INITIALIZED and the IRQ handler won't
care any longer about IRQs, thus the kernel will disable the IRQ if it's
shared (unless we boot it with the 'irqpoll' option). So we must disable
IRQs before changing the device status.


Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it>

---

--- wireless-2.6/drivers/net/wireless/b43/main.c.orig	2007-11-07 17:55:30.553591943 +0100
+++ wireless-2.6/drivers/net/wireless/b43/main.c	2007-11-07 17:59:23.356020048 +0100
@@ -2979,6 +2979,16 @@
 
 	if (b43_status(dev) < B43_STAT_STARTED)
 		return;
+
+	/* Disable and sync interrupts. We must do this before than
+	 * setting the status to INITIALIZED, as the interrupt handler
+	 * won't care about IRQs then. */
+	spin_lock_irqsave(&wl->irq_lock, flags);
+	dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
+	b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);	/* flush */
+	spin_unlock_irqrestore(&wl->irq_lock, flags);
+	b43_synchronize_irq(dev);
+
 	b43_set_status(dev, B43_STAT_INITIALIZED);
 
 	mutex_unlock(&wl->mutex);
@@ -2989,13 +2999,6 @@
 
 	ieee80211_stop_queues(wl->hw);	//FIXME this could cause a deadlock, as mac80211 seems buggy.
 
-	/* Disable and sync interrupts. */
-	spin_lock_irqsave(&wl->irq_lock, flags);
-	dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
-	b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);	/* flush */
-	spin_unlock_irqrestore(&wl->irq_lock, flags);
-	b43_synchronize_irq(dev);
-
 	b43_mac_suspend(dev);
 	free_irq(dev->dev->irq, dev);
 	b43dbg(wl, "Wireless interface stopped\n");


-- 
Ciao
Stefano

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] b43: fix shared IRQ race condition
  2007-11-07 17:16 [PATCH] b43: fix shared IRQ race condition Stefano Brivio
@ 2007-11-07 17:31 ` Michael Buesch
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Buesch @ 2007-11-07 17:31 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: John W. Linville, linux-wireless, bcm43xx-dev

On Wednesday 07 November 2007 18:16:11 Stefano Brivio wrote:
> Fix an IRQ race condition in b43. If we call b43_stop_wireless_core(), it
> will set the status of the device to INITIALIZED and the IRQ handler won't
> care any longer about IRQs, thus the kernel will disable the IRQ if it's
> shared (unless we boot it with the 'irqpoll' option). So we must disable
> IRQs before changing the device status.
> 
> 
> Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it>
> 
> ---
> 
> --- wireless-2.6/drivers/net/wireless/b43/main.c.orig	2007-11-07 17:55:30.553591943 +0100
> +++ wireless-2.6/drivers/net/wireless/b43/main.c	2007-11-07 17:59:23.356020048 +0100
> @@ -2979,6 +2979,16 @@
>  
>  	if (b43_status(dev) < B43_STAT_STARTED)
>  		return;
> +
> +	/* Disable and sync interrupts. We must do this before than
> +	 * setting the status to INITIALIZED, as the interrupt handler
> +	 * won't care about IRQs then. */
> +	spin_lock_irqsave(&wl->irq_lock, flags);
> +	dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
> +	b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);	/* flush */
> +	spin_unlock_irqrestore(&wl->irq_lock, flags);
> +	b43_synchronize_irq(dev);
> +
>  	b43_set_status(dev, B43_STAT_INITIALIZED);
>  
>  	mutex_unlock(&wl->mutex);
> @@ -2989,13 +2999,6 @@
>  
>  	ieee80211_stop_queues(wl->hw);	//FIXME this could cause a deadlock, as mac80211 seems buggy.
>  
> -	/* Disable and sync interrupts. */
> -	spin_lock_irqsave(&wl->irq_lock, flags);
> -	dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
> -	b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);	/* flush */
> -	spin_unlock_irqrestore(&wl->irq_lock, flags);
> -	b43_synchronize_irq(dev);
> -
>  	b43_mac_suspend(dev);
>  	free_irq(dev->dev->irq, dev);
>  	b43dbg(wl, "Wireless interface stopped\n");
> 
> 

Acked-by: Michael Buesch <mb@bu3sch.de>

-- 
Greetings Michael.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-07 17:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 17:16 [PATCH] b43: fix shared IRQ race condition Stefano Brivio
2007-11-07 17:31 ` Michael Buesch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).