sky2: Lock transmit queue while disabling device
authorMike McCormack <mikem@ring3k.org>
Thu, 31 Dec 2009 00:55:31 +0000 (00:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Jan 2010 04:26:14 +0000 (20:26 -0800)
netif_device_detach() does not take the tx_lock, so it's possible that
a call to sky2_xmit_frame is still in progress after
netif_device_detach() is complete.

Take netif_tx_lock() to make sure all transmits have stopped while
we're disabling the devices and that no other CPU is still
transmitting a frame after we've disabling the device.

Proposed fix for "sky2 panic under load" reported by Berck E. Nash.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/sky2.c

index faa48410195efba4df78e2fabc18226f3c96ec00..8ae8520baaf3b4dd2b375022cc2860403aed5121 100644 (file)
@@ -3176,7 +3176,9 @@ static void sky2_reset(struct sky2_hw *hw)
 static void sky2_detach(struct net_device *dev)
 {
        if (netif_running(dev)) {
+               netif_tx_lock(dev);
                netif_device_detach(dev);       /* stop txq */
+               netif_tx_unlock(dev);
                sky2_down(dev);
        }
 }