e100: Fix the TX workqueue race

Previous thread: ext4: Fix possible lost inode write in no journal mode by Linux Kernel Mailing List on Sunday, April 25, 2010 - 4:59 pm. (1 message)

Next thread: ext4: Fix buffer head leaks after calls to ext4_get_inode_loc() by Linux Kernel Mailing List on Sunday, April 25, 2010 - 4:59 pm. (1 message)
From: Linux Kernel Mailing List
Date: Sunday, April 25, 2010 - 4:59 pm

Gitweb:     http://git.kernel.org/linus/401da6aea31ef69c2fcd260382adabdcf7ce820a
Commit:     401da6aea31ef69c2fcd260382adabdcf7ce820a
Parent:     7ce97d4f78b62e3af24cdd4df953d777e7efb2f6
Author:     Alan Cox <alan@linux.intel.com>
AuthorDate: Sat Apr 24 21:09:29 2010 -0700
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Sat Apr 24 21:09:29 2010 -0700

    e100: Fix the TX workqueue race
    
    Nothing stops the workqueue being left to run in parallel with close or a
    few other operations. This causes double unmaps and the like.
    
    See kerneloops.org #1041230 for an example
    
    Signed-off-by: Alan Cox <alan@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/e100.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index b997e57..7910803 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -166,6 +166,7 @@
 #include <linux/ethtool.h>
 #include <linux/string.h>
 #include <linux/firmware.h>
+#include <linux/rtnetlink.h>
 #include <asm/unaligned.h>
 
 
@@ -2265,8 +2266,13 @@ static void e100_tx_timeout_task(struct work_struct *work)
 
 	DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n",
 		ioread8(&nic->csr->scb.status));
-	e100_down(netdev_priv(netdev));
-	e100_up(netdev_priv(netdev));
+
+	rtnl_lock();
+	if (netif_running(netdev)) {
+		e100_down(netdev_priv(netdev));
+		e100_up(netdev_priv(netdev));
+	}
+	rtnl_unlock();
 }
 
 static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
--

Previous thread: ext4: Fix possible lost inode write in no journal mode by Linux Kernel Mailing List on Sunday, April 25, 2010 - 4:59 pm. (1 message)

Next thread: ext4: Fix buffer head leaks after calls to ext4_get_inode_loc() by Linux Kernel Mailing List on Sunday, April 25, 2010 - 4:59 pm. (1 message)