Re: [PATCH 7/8] b44: race on device closing

2005-11-07 Thread Jeff Garzik

Francois Romieu wrote:

Usual fix:
- b44_interrupt() does not schedule NAPI polling when the device is
  going down;
- b44_close() waits for any scheduled NAPI polling before it starts
  to release the device private structures.

Signed-off-by: Francois Romieu <[EMAIL PROTECTED]>

---

466c09c176a11241f93af7156538f3dd5f6fb6d1
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -909,6 +909,12 @@ static irqreturn_t b44_interrupt(int irq
istat &= imask;
if (istat) {
handled = 1;
+
+   if (unlikely(!netif_running(dev))) {
+   printk(KERN_INFO "%s: late interrupt.\n", dev->name);
+   goto out_unlock;
+   }
+
if (netif_rx_schedule_prep(dev)) {
/* NOTE: These writes are posted by the readback of
 *   the ISTAT register below.


If you get to this point, you should still ACK the interrupt to the 
hardware.


Jeff


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] b44: race on device closing

2005-11-06 Thread Francois Romieu
Usual fix:
- b44_interrupt() does not schedule NAPI polling when the device is
  going down;
- b44_close() waits for any scheduled NAPI polling before it starts
  to release the device private structures.

Signed-off-by: Francois Romieu <[EMAIL PROTECTED]>

---

466c09c176a11241f93af7156538f3dd5f6fb6d1
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -909,6 +909,12 @@ static irqreturn_t b44_interrupt(int irq
istat &= imask;
if (istat) {
handled = 1;
+
+   if (unlikely(!netif_running(dev))) {
+   printk(KERN_INFO "%s: late interrupt.\n", dev->name);
+   goto out_unlock;
+   }
+
if (netif_rx_schedule_prep(dev)) {
/* NOTE: These writes are posted by the readback of
 *   the ISTAT register below.
@@ -924,6 +930,7 @@ static irqreturn_t b44_interrupt(int irq
bw32(bp, B44_ISTAT, istat);
br32(bp, B44_ISTAT);
}
+out_unlock:
spin_unlock(&bp->lock);
return IRQ_RETVAL(handled);
 }
@@ -1446,6 +1453,8 @@ static int b44_close(struct net_device *
 
netif_stop_queue(dev);
 
+   netif_poll_disable(dev);
+
del_timer_sync(&bp->timer);
 
spin_lock_irq(&bp->lock);
@@ -1461,6 +1470,8 @@ static int b44_close(struct net_device *
 
free_irq(dev->irq, dev);
 
+   netif_poll_enable(dev);
+
b44_free_consistent(bp);
 
return 0;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html