Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934048AbXEUTdc (ORCPT ); Mon, 21 May 2007 15:33:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763263AbXEUTWI (ORCPT ); Mon, 21 May 2007 15:22:08 -0400 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:46477 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765495AbXEUTWG (ORCPT ); Mon, 21 May 2007 15:22:06 -0400 Message-Id: <20070521191754.252731000@sous-sol.org> References: <20070521191612.800400000@sous-sol.org> User-Agent: quilt/0.46-1 Date: Mon, 21 May 2007 12:17:14 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Stephen Hemminger , netdev@vger.kernel.org Subject: [patch 62/69] sky2: fix oops on shutdown Content-Disposition: inline; filename=sky2-fix-oops-on-shutdown.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1687 Lines: 63 -stable review patch. If anyone has any objections, please let us know. --------------------- From: Stephen Hemminger If the device 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 Signed-off-by: Chris Wright --- drivers/net/sky2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- linux-2.6.21.1.orig/drivers/net/sky2.c +++ linux-2.6.21.1/drivers/net/sky2.c @@ -3719,6 +3719,7 @@ err_out_free_regions: pci_release_regions(pdev); pci_disable_device(pdev); err_out: + pci_set_drvdata(pdev, NULL); return err; } @@ -3771,6 +3772,9 @@ static int sky2_suspend(struct pci_dev * 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]); @@ -3802,6 +3806,9 @@ static int sky2_resume(struct pci_dev *p 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; @@ -3848,6 +3855,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]); -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/