Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, jkarlson@cc.hut.fi
Subject: [PATCH] sky2: crash on remove
Date: Mon, 22 Oct 2007 13:39:09 -0700	[thread overview]
Message-ID: <20071022133909.6a5453c7@freepuppy.rosehill> (raw)
In-Reply-To: <20071022111235.266a10df.akpm@linux-foundation.org>

Fix off-by one in remove logic that just got introduced.

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

---
This only occurs in new post 2.6.23 code.

--- a/drivers/net/sky2.c	2007-10-22 09:38:11.000000000 -0700
+++ b/drivers/net/sky2.c	2007-10-22 12:11:22.000000000 -0700
@@ -4271,7 +4271,7 @@ static void __devexit sky2_remove(struct
 	del_timer_sync(&hw->watchdog_timer);
 	cancel_work_sync(&hw->restart_work);
 
-	for (i = hw->ports; i >= 0; --i)
+	for (i = hw->ports-1; i >= 0; --i)
 		unregister_netdev(hw->dev[i]);
 
 	sky2_write32(hw, B0_IMSK, 0);
@@ -4289,7 +4289,7 @@ static void __devexit sky2_remove(struct
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 
-	for (i = hw->ports; i >= 0; --i)
+	for (i = hw->ports-1; i >= 0; --i)
 		free_netdev(hw->dev[i]);
 
 	iounmap(hw->regs);

  reply	other threads:[~2007-10-22 20:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-9208-10286@http.bugzilla.kernel.org/>
2007-10-22 18:12 ` [Bugme-new] [Bug 9208] New: Oops on sky2, delete_module causes SIGKILL Andrew Morton
2007-10-22 20:39   ` Stephen Hemminger [this message]
2007-10-24  0:23     ` [PATCH] sky2: crash on remove Jeff Garzik

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=20071022133909.6a5453c7@freepuppy.rosehill \
    --to=shemminger@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --cc=jkarlson@cc.hut.fi \
    --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