All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: stable@kernel.org
Cc: netdev@vger.kernel.org
Subject: [PATCH 6/6] sky2: fix oops on shutdown
Date: Tue, 15 May 2007 15:08:27 -0700	[thread overview]
Message-ID: <20070515220903.877649648@linux-foundation.org> (raw)
In-Reply-To: 20070515220821.676720721@linux-foundation.org

[-- Attachment #1: sky2-shutdown.patch --]
[-- Type: text/plain, Size: 1362 bytes --]

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 <shemminger@linux-foundation.org>

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

--- linux-2.6.21.y.orig/drivers/net/sky2.c	2007-05-15 09:07:14.000000000 -0700
+++ linux-2.6.21.y/drivers/net/sky2.c	2007-05-15 09:07:32.000000000 -0700
@@ -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]);
 

--
Stephen Hemminger <shemminger@linux-foundation.org>


      parent reply	other threads:[~2007-05-15 22:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15 22:08 [PATCH 0/6] skge/sky2 patches for 2.6.21.2 Stephen Hemminger
2007-05-15 22:08 ` [PATCH 1/6] skge: allow WOL except for known broken chips Stephen Hemminger
2007-05-15 22:08 ` [PATCH 2/6] skge: default WOL should be magic only Stephen Hemminger
2007-05-15 22:08 ` [PATCH 3/6] sky2: allow 88E8056 Stephen Hemminger
2007-05-17  1:23   ` [stable] " Chris Wright
2007-05-15 22:08 ` [PATCH 4/6] sky2: 88e8071 support not ready Stephen Hemminger
2007-05-17  1:24   ` [stable] " Chris Wright
2007-05-15 22:08 ` [PATCH 5/6] skge: crash on shutdown/suspend Stephen Hemminger
2007-05-15 22:08 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070515220903.877649648@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.