diff mbox

[7/8] sky2: hold RTNL when doing suspend/shutdown operations

Message ID 20090806161232.998780534@vyatta.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Aug. 6, 2009, 4:12 p.m. UTC
The suspend and shutdown code plays with shared state. Use consistent
locking, for extra protection. 

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
diff mbox

Patch

--- a/drivers/net/sky2.c	2009-08-06 08:29:58.560356154 -0700
+++ b/drivers/net/sky2.c	2009-08-06 08:32:06.128478111 -0700
@@ -4635,6 +4635,7 @@  static int sky2_suspend(struct pci_dev *
 	del_timer_sync(&hw->watchdog_timer);
 	cancel_work_sync(&hw->restart_work);
 
+	rtnl_lock();
 	for (i = 0; i < hw->ports; i++) {
 		struct net_device *dev = hw->dev[i];
 		struct sky2_port *sky2 = netdev_priv(dev);
@@ -4652,6 +4653,7 @@  static int sky2_suspend(struct pci_dev *
 	sky2_write32(hw, B0_IMSK, 0);
 	napi_disable(&hw->napi);
 	sky2_power_aux(hw);
+	rtnl_unlock();
 
 	pci_save_state(pdev);
 	pci_enable_wake(pdev, pci_choose_state(pdev, state), wol);
@@ -4721,6 +4723,7 @@  static void sky2_shutdown(struct pci_dev
 	if (!hw)
 		return;
 
+	rtnl_lock();
 	del_timer_sync(&hw->watchdog_timer);
 
 	for (i = 0; i < hw->ports; i++) {
@@ -4735,6 +4738,7 @@  static void sky2_shutdown(struct pci_dev
 
 	if (wol)
 		sky2_power_aux(hw);
+	rtnl_unlock();
 
 	pci_enable_wake(pdev, PCI_D3hot, wol);
 	pci_enable_wake(pdev, PCI_D3cold, wol);