netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b44: netpoll locking fix
@ 2007-05-29 21:14 Francois Romieu
  2007-05-29 21:27 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Francois Romieu @ 2007-05-29 21:14 UTC (permalink / raw)
  To: Gary Zambrano; +Cc: jgarzik, akpm, netdev

The irq handling thread (b44_interrupt) uses the same lock as the NAPI
thread. This change should prevent a deadlock if something interrupts
the b44 NAPI thread and tries to printk through netconsole.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/b44.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 879a2ff..64d75e4 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -853,16 +853,18 @@ static int b44_rx(struct b44 *bp, int budget)
 static int b44_poll(struct net_device *netdev, int *budget)
 {
 	struct b44 *bp = netdev_priv(netdev);
+	unsigned long flags;
 	int done;
 
-	spin_lock_irq(&bp->lock);
+	spin_lock_irqsave(&bp->lock, flags);
 
 	if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
 		/* spin_lock(&bp->tx_lock); */
 		b44_tx(bp);
 		/* spin_unlock(&bp->tx_lock); */
 	}
-	spin_unlock_irq(&bp->lock);
+
+	spin_unlock_irqrestore(&bp->lock, flags);
 
 	done = 1;
 	if (bp->istat & ISTAT_RX) {
@@ -882,8 +884,6 @@ static int b44_poll(struct net_device *netdev, int *budget)
 	}
 
 	if (bp->istat & ISTAT_ERRORS) {
-		unsigned long flags;
-
 		spin_lock_irqsave(&bp->lock, flags);
 		b44_halt(bp);
 		b44_init_rings(bp);
-- 
1.5.2


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

end of thread, other threads:[~2007-05-29 23:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 21:14 [PATCH] b44: netpoll locking fix Francois Romieu
2007-05-29 21:27 ` Stephen Hemminger
2007-05-29 22:20   ` Francois Romieu
2007-05-29 22:30     ` Stephen Hemminger
2007-05-29 23:13     ` John W. Linville

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).