netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/4] skge: crash on shutdown/suspend
Date: Fri, 11 May 2007 11:21:45 -0700	[thread overview]
Message-ID: <20070511182251.370243367@linux-foundation.org> (raw)
In-Reply-To: 20070511182143.872814956@linux-foundation.org

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

If device is not fails during module startup (like unsupported chip
version) then driver would crash dereferencing a null pointer, on shutdown
or suspend/resume.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

---
 drivers/net/skge.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- sky2-2.6.21.orig/drivers/net/skge.c	2007-05-10 10:44:29.000000000 -0700
+++ sky2-2.6.21/drivers/net/skge.c	2007-05-10 10:45:57.000000000 -0700
@@ -3802,6 +3802,9 @@ static int skge_suspend(struct pci_dev *
 	struct skge_hw *hw  = pci_get_drvdata(pdev);
 	int i, err, wol = 0;
 
+	if (!hw)
+		return 0;
+
 	err = pci_save_state(pdev);
 	if (err)
 		return err;
@@ -3830,6 +3833,9 @@ static int skge_resume(struct pci_dev *p
 	struct skge_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;
@@ -3868,6 +3874,9 @@ static void skge_shutdown(struct pci_dev
 	struct skge_hw *hw  = pci_get_drvdata(pdev);
 	int i, wol = 0;
 
+	if (!hw)
+		return;
+
 	for (i = 0; i < hw->ports; i++) {
 		struct net_device *dev = hw->dev[i];
 		struct skge_port *skge = netdev_priv(dev);

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


  parent reply	other threads:[~2007-05-11 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-11 18:21 [PATCH 0/4] sky2/skge bug fix patches for 2.6.22 Stephen Hemminger
2007-05-11 18:21 ` [PATCH 1/4] sky2: fix oops on shutdown Stephen Hemminger
2007-05-11 20:58   ` Jeff Garzik
2007-05-11 18:21 ` Stephen Hemminger [this message]
2007-05-11 18:21 ` [PATCH 3/4] sky2: 88e8071 support not ready Stephen Hemminger
2007-05-11 18:21 ` [PATCH 4/4] sky2: only disable 88e8056 on some boards Stephen Hemminger

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=20070511182251.370243367@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).