From: Andrew Morton <akpm@linux-foundation.org>
To: Micah Gruber <micah.gruber@gmail.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
jgarzik@pobox.com, Grant Grundler <grundler@parisc-linux.org>
Subject: Re: [CORRECTION][PATCH] Fix a potential NULL pointer dereference in uli526x_interrupt() in drivers/net/tulip/uli526x.c
Date: Thu, 13 Sep 2007 02:03:46 -0700 [thread overview]
Message-ID: <20070913020346.979647c1.akpm@linux-foundation.org> (raw)
In-Reply-To: <46DD13CE.6010905@gmail.com>
On Tue, 04 Sep 2007 16:14:06 +0800 Micah Gruber <micah.gruber@gmail.com> wrote:
> This patch fixes a potential null dereference bug where we dereference dev before a null check. This patch simply moves the dereferencing after the null check.
>
> Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
> ---
>
> --- a/drivers/net/tulip/uli526x.c
> +++ b/drivers/net/tulip/uli526x.c
> @@ -663,7 +663,7 @@
> {
> struct net_device *dev = dev_id;
> struct uli526x_board_info *db = netdev_priv(dev);
> - unsigned long ioaddr = dev->base_addr;
> + unsigned long ioaddr;
> unsigned long flags;
>
> if (!dev) {
> @@ -671,6 +671,8 @@
> return IRQ_NONE;
> }
>
> + ioaddr = dev->base_addr;
> +
> spin_lock_irqsave(&db->lock, flags);
> outl(0, ioaddr + DCR7);
>
I suspect the fix we want is:
--- a/drivers/net/tulip/uli526x.c~fix-a-potential-null-pointer-dereference-in-uli526x_interrupt
+++ a/drivers/net/tulip/uli526x.c
@@ -666,11 +666,6 @@ static irqreturn_t uli526x_interrupt(int
unsigned long ioaddr = dev->base_addr;
unsigned long flags;
- if (!dev) {
- ULI526X_DBUG(1, "uli526x_interrupt() without DEVICE arg", 0);
- return IRQ_NONE;
- }
-
spin_lock_irqsave(&db->lock, flags);
outl(0, ioaddr + DCR7);
_
next prev parent reply other threads:[~2007-09-13 9:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-04 8:14 [CORRECTION][PATCH] Fix a potential NULL pointer dereference in uli526x_interrupt() in drivers/net/tulip/uli526x.c Micah Gruber
2007-09-07 23:20 ` Jeff Garzik
2007-09-13 9:03 ` Andrew Morton [this message]
2007-09-13 9:03 ` Kyle McMartin
2007-09-13 14:16 ` 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=20070913020346.979647c1.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=grundler@parisc-linux.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=micah.gruber@gmail.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).