public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat•com>
To: Florian Westphal <fw@strlen•de>
Cc: netfilter-devel@vger•kernel.org, netdev@vger•kernel.org,
	Pablo Neira Ayuso <pablo@netfilter•org>
Subject: Re: [PATCH nf-next 2/2] nf_set_hooks_head: acommodate different kconfig
Date: Mon, 26 Sep 2016 12:43:17 -0400	[thread overview]
Message-ID: <f7t4m52lihm.fsf@redhat.com> (raw)
In-Reply-To: <20160926163920.GB17426@breakpoint.cc> (Florian Westphal's message of "Mon, 26 Sep 2016 18:39:20 +0200")

Florian Westphal <fw@strlen•de> writes:

> Aaron Conole <aconole@bytheb•org> wrote:
>> When CONFIG_NETFILTER_INGRESS is unset (or no), we need to handle
>> the request for registration properly by dropping the hook.  This
>> releases the entry during the set.
>> 
>> Signed-off-by: Aaron Conole <aconole@bytheb•org>
>> ---
>>  net/netfilter/core.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
>> index e58e420..1d0a4c9 100644
>> --- a/net/netfilter/core.c
>> +++ b/net/netfilter/core.c
>> @@ -90,10 +90,14 @@ static void nf_set_hooks_head(struct net *net, const struct nf_hook_ops *reg,
>>  {
>>  	switch (reg->pf) {
>>  	case NFPROTO_NETDEV:
>> +#ifdef CONFIG_NETFILTER_INGRESS
>>  		/* We already checked in nf_register_net_hook() that this is
>>  		 * used from ingress.
>>  		 */
>>  		rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
>> +#else
>> +		kfree(entry);
>> +#endif
>>  		break;
>
> This looks dodgy (its correct though).
>
> I'd propose to add a test to nf_register_net_hook()
> to bail with -EOPNOSTUPP instead of this "#else kfree()" if we get
> NFPROTO_NETDEV pf with CONFIG_NETFILTER_INGRESS=n build instead.

Okay, I'll spin a new version.

Thanks for the review, Florian!

-Aaron

      reply	other threads:[~2016-09-26 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 16:24 [PATCH nf-next 0/2] fixes for recent nf_compact hooks Aaron Conole
2016-09-26 16:24 ` [PATCH nf-next 1/2] netfilter: Fix potential null pointer dereference Aaron Conole
2016-09-26 16:24 ` [PATCH nf-next 2/2] nf_set_hooks_head: acommodate different kconfig Aaron Conole
2016-09-26 16:39   ` Florian Westphal
2016-09-26 16:43     ` Aaron Conole [this message]

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=f7t4m52lihm.fsf@redhat.com \
    --to=aconole@redhat$(echo .)com \
    --cc=fw@strlen$(echo .)de \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=netfilter-devel@vger$(echo .)kernel.org \
    --cc=pablo@netfilter$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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