aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-05-11 11:21:44 -0700
committerJeff Garzik <jeff@garzik.org>2007-05-11 17:53:33 -0400
commit549a68c3fe2ca320b0764d1289d17af797daa5d1 (patch)
tree0c9f4b729ba37f6c28b725f885dc5ac6b9173485
parent4093785dd16d0b7058eb92331bfd7b40b12151f3 (diff)
sky2: fix oops on shutdown
If the device is fails during module startup for some reason like unsupported chip version then the driver would crash dereferencing a null pointer, on shutdown or suspend/resume. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/sky2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a307310f13f..3764008270a 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3732,6 +3732,7 @@ err_out_free_regions:
err_out_disable:
pci_disable_device(pdev);
err_out:
+ pci_set_drvdata(pdev, NULL);
return err;
}
@@ -3784,6 +3785,9 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
struct sky2_hw *hw = pci_get_drvdata(pdev);
int i, wol = 0;
+ if (!hw)
+ return 0;
+
del_timer_sync(&hw->idle_timer);
netif_poll_disable(hw->dev[0]);
@@ -3815,6 +3819,9 @@ static int sky2_resume(struct pci_dev *pdev)
struct sky2_hw *hw = pci_get_drvdata(pdev);
int i, err;
+ if (!hw)
+ return 0;
+
err = pci_set_power_state(pdev, PCI_D0);
if (err)
goto out;
@@ -3861,6 +3868,9 @@ static void sky2_shutdown(struct pci_dev *pdev)
struct sky2_hw *hw = pci_get_drvdata(pdev);
int i, wol = 0;
+ if (!hw)
+ return;
+
del_timer_sync(&hw->idle_timer);
netif_poll_disable(hw->dev[0]);