From: David Miller <davem@davemloft.net>
To: mpm@selenic.com
Cc: jirislaby@gmail.com, jslaby@suse.cz, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, danborkmann@googlemail.com
Subject: Re: [PATCH 1/1] NET: netpoll, fix potential NULL ptr dereference
Date: Tue, 16 Mar 2010 14:29:37 -0700 (PDT) [thread overview]
Message-ID: <20100316.142937.144445591.davem@davemloft.net> (raw)
In-Reply-To: <1268762160.25503.2988.camel@calx>
From: Matt Mackall <mpm@selenic.com>
Date: Tue, 16 Mar 2010 12:56:00 -0500
> On Tue, 2010-03-16 at 18:22 +0100, Jiri Slaby wrote:
>> On 03/16/2010 06:12 PM, Matt Mackall wrote:
>> > I don't get it. The source of the branch tests for !ndev->npinfo and the
>> > original destination of the branch also tests for !ndev->npinfo. I don't
>> > see how it gets dereferenced.
>>
>> Let's look at more of the context:
>> if (!ndev->npinfo) {
>> npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL);
>> if (!npinfo) { // npinfo is NULL
>> err = -ENOMEM;
>> goto release;
>> }
>> ...
>> release: // npinfo is still NULL
>> if (!ndev->npinfo) { // condition is the same (holds)
>> // dereference below: vvvvvvvvvvvvvvv
>> spin_lock_irqsave(&npinfo->rx_lock, flags);
>> list_for_each_entry_safe(npe, tmp, &npinfo->rx_np, rx) {
>> npe->dev = NULL;
>> }
>> spin_unlock_irqrestore(&npinfo->rx_lock, flags);
>>
>> kfree(npinfo);
>> }
>
> Ok, you're correct, I read the second test backwards.
>
> Acked-by: Matt Mackall <mpm@selenic.com>
Applied, thanks everyone.
next prev parent reply other threads:[~2010-03-16 21:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 15:29 [PATCH 1/1] NET: netpoll, fix potential NULL ptr dereference Jiri Slaby
2010-03-16 16:57 ` Laurent Chavey
2010-03-16 17:12 ` Matt Mackall
2010-03-16 17:22 ` Jiri Slaby
2010-03-16 17:56 ` Matt Mackall
2010-03-16 21:29 ` David Miller [this message]
2010-03-18 14:55 ` Daniel Borkmann
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=20100316.142937.144445591.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=danborkmann@googlemail.com \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.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).