From: Aaron Conole <aconole@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
Florian Westphal <fw@strlen.de>,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH nf-next v3 1/2] netfilter: Fix potential null pointer dereference
Date: Wed, 28 Sep 2016 10:56:31 -0400 [thread overview]
Message-ID: <f7ty42chy3k.fsf@redhat.com> (raw)
In-Reply-To: <1475069735.28155.102.camel@edumazet-glaptop3.roam.corp.google.com> (Eric Dumazet's message of "Wed, 28 Sep 2016 06:35:35 -0700")
Eric Dumazet <eric.dumazet@gmail.com> writes:
> On Wed, 2016-09-28 at 09:12 -0400, Aaron Conole 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
>> entry in the list, both will enter the nf_hook_mutex critical section.
>> The first will successfully delete the head, but the second will see
>> this NULL pointer and attempt to dereference.
>>
>> This fix ensures that no null pointer dereference could occur when such
>> a condition happens.
>>
>> Signed-off-by: Aaron Conole <aconole@bytheb.org>
>> ---
>> net/netfilter/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
>> index 360c63d..e58e420 100644
>> --- a/net/netfilter/core.c
>> +++ b/net/netfilter/core.c
>> @@ -160,7 +160,7 @@ void nf_unregister_net_hook(struct net *net, const struct nf_hook_ops *reg)
>>
>> mutex_lock(&nf_hook_mutex);
>> hooks_entry = nf_hook_entry_head(net, reg);
>> - if (hooks_entry->orig_ops == reg) {
>> + if (hooks_entry && hooks_entry->orig_ops == reg) {
>> nf_set_hooks_head(net, reg,
>> nf_entry_dereference(hooks_entry->next));
>> goto unlock;
>
> When was the bug added exactly ?
Sunday, on the nf-next tree.
> For all bug fixes, you need to add a Fixes: tag.
>
> Like :
>
> Fixes: e3b37f11e6e4 ("netfilter: replace list_head with single linked list")
I would but it's in nf-next tree, and I'm not sure how pulls go. If
they are done via patch imports, then the sha sums will be wrong and the
commit message will be misleading. If the sums are preserved, then I
can resubmit with this information.
> So that 100 different people in stable teams do not have to do the
> archeology themselves ...
>
> Thanks.
Thanks for the review, Eric.
next prev parent reply other threads:[~2016-09-28 14:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 13:12 [PATCH nf-next v3 0/2] fixes for recent nf_compact hooks Aaron Conole
2016-09-28 13:12 ` [PATCH nf-next v3 1/2] netfilter: Fix potential null pointer dereference Aaron Conole
2016-09-28 13:35 ` Eric Dumazet
2016-09-28 14:56 ` Aaron Conole [this message]
2016-09-28 15:30 ` Eric Dumazet
2016-09-28 15:38 ` Aaron Conole
2016-09-28 13:12 ` [PATCH nf-next v3 2/2] nf_set_hooks_head: accommodate 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=f7ty42chy3k.fsf@redhat.com \
--to=aconole@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).