netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@bytheb.org>
To: Liping Zhang <zlpnobody@gmail.com>
Cc: Feng Gao <gfree.wind@gmail.com>,
	Netfilter Developer Mailing List
	<netfilter-devel@vger.kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH nf-next v2 1/2] netfilter: Fix potential null pointer dereference
Date: Wed, 28 Sep 2016 09:30:36 -0400	[thread overview]
Message-ID: <f7tponokv7n.fsf@redhat.com> (raw)
In-Reply-To: <CAML_gOeqjO--cPu=vt+ed14NqXP1uU41J0RDg5Up7xM79SCWjQ@mail.gmail.com> (Liping Zhang's message of "Wed, 28 Sep 2016 11:13:07 +0800")

Liping Zhang <zlpnobody@gmail.com> writes:

> 2016-09-28 11:08 GMT+08:00 Liping Zhang <zlpnobody@gmail.com>:
>> Hi Feng,
>>
>> 2016-09-28 9:23 GMT+08:00 Feng Gao <gfree.wind@gmail.com>:
>>> Hi Aaraon,
>>>
>>> On Tue, Sep 27, 2016 at 9:38 PM, Aaron Conole <aconole@bytheb.org> wrote:
>>>> It's possible for nf_hook_entry_head to return NULL if two
>>>> nf_unregister_net_hook calls happen simultaneously with a single hook
>>>
>>> The critical region of nf_unregister_net_hook is protected by &nf_hook_mutex.
>>> When it would be called simultaneously?
>>
>> This is unrelated to race condition.
>>
>> Suppose that only the last nf_hook_entry exist, and two callers want to do
>> un-register work.
>>
>> The first one will remove it successfully, after the end of the work, the
>> second one will enter the critical section, but it will see the NULL pointer.
>> Because the last nf_hook_entry was already removed by the first one.
>>
>>>
>>> Regards
>>> Feng
>>>
>>>> entry in the list.  This fix ensures that no null pointer dereference
>>>> could occur when such a race happens.
>>>>
>>>> Signed-off-by: Aaron Conole <aconole@bytheb.org>
>
> I read the commit log again, I think the description here is a
> little confusing indeed.

Sorry about that.  I've posted a new description which describes the
situation better.  I hope it helps.

-Aaron

  parent reply	other threads:[~2016-09-28 13:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 13:38 [PATCH nf-next v2 0/2] fixes for recent nf_compact hooks Aaron Conole
2016-09-27 13:38 ` [PATCH nf-next v2 1/2] netfilter: Fix potential null pointer dereference Aaron Conole
2016-09-28  1:23   ` Feng Gao
2016-09-28  3:08     ` Liping Zhang
2016-09-28  3:13       ` Liping Zhang
2016-09-28  7:56         ` Feng Gao
2016-09-28 13:30         ` Aaron Conole [this message]
2016-09-27 13:38 ` [PATCH nf-next v2 2/2] nf_set_hooks_head: acommodate different kconfig Aaron Conole

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=f7tponokv7n.fsf@redhat.com \
    --to=aconole@bytheb.org \
    --cc=fw@strlen.de \
    --cc=gfree.wind@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=zlpnobody@gmail.com \
    /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).