Subject: [PATCH 01/17] sky2: fix oops on shutdown

From: Stephen Hemminger <[email-masked]>
Date: Tue, 08 May 2007 20:49:50 -0700

If device is not fails during module startup (like unsupported chip
version) then driver would crash dereferencing a null pointer.

Signed-off-by: Stephen Hemminger <[email-masked]>

---
 drivers/net/sky2.c |    4 ++++
 1 file changed, 4 insertions(+)

--- sky2-2.6.21.orig/drivers/net/sky2.c	2007-05-08 15:14:45.000000000 -0700
+++ sky2-2.6.21/drivers/net/sky2.c	2007-05-08 15:16:12.000000000 -0700
@@ -3732,6 +3732,7 @@ err_out_free_regions:
 err_out_disable:
 	pci_disable_device(pdev);
 err_out:
+	pci_set_drvdata(pdev, NULL);
 	return err;
 }
 
@@ -3861,6 +3862,9 @@ static void sky2_shutdown(struct pci_dev
 	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]);

--