Subject: [PATCH 3/4] forcedeth: napi schedule lock fix

From: Ayaz Abdulla <[email-masked]>
Date: Fri, 09 Jan 2009 16:03:49 -0500

This patch fixes a potential race condition between scheduling napi and 
completing napi poll. The call to netif_rx_schedule should be under 
protection of the lock (as is the completion), otherwise, interrupts 
could be masked off.

Signed-off-by: Ayaz Abdulla <[email-masked]>

--- old/drivers/net/forcedeth.c	2009-01-09 15:11:55.000000000 -0800
+++ new/drivers/net/forcedeth.c	2009-01-09 15:17:27.000000000 -0800
@@ -3407,10 +3407,10 @@
 
 #ifdef CONFIG_FORCEDETH_NAPI
 		if (events & NVREG_IRQ_RX_ALL) {
+			spin_lock(&np->lock);
 			netif_rx_schedule(dev, &np->napi);
 
 			/* Disable furthur receive irq's */
-			spin_lock(&np->lock);
 			np->irqmask &= ~NVREG_IRQ_RX_ALL;
 
 			if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -3524,10 +3524,10 @@
 
 #ifdef CONFIG_FORCEDETH_NAPI
 		if (events & NVREG_IRQ_RX_ALL) {
+			spin_lock(&np->lock);
 			netif_rx_schedule(dev, &np->napi);
 
 			/* Disable furthur receive irq's */
-			spin_lock(&np->lock);
 			np->irqmask &= ~NVREG_IRQ_RX_ALL;
 
 			if (np->msi_flags & NV_MSI_X_ENABLED)