All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Aaron Conole <aconole@bytheb.org>
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 3/3] netfilter: replace list_head with single linked list
Date: Sat, 9 Jul 2016 01:30:38 +0200	[thread overview]
Message-ID: <20160708233038.GA2067@breakpoint.cc> (raw)
In-Reply-To: <1467321575-6107-4-git-send-email-aconole@bytheb.org>

Aaron Conole <aconole@bytheb.org> wrote:
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core
[..]
> +#define nf_entry_dereference(e) \
> +	rcu_dereference_protected(e, lockdep_is_held(&nf_hook_mutex))
>  
> -static struct list_head *nf_find_hook_list(struct net *net,
> -					   const struct nf_hook_ops *reg)
> +static struct nf_hook_entry *nf_find_hook_list(struct net *net,
> +					       const struct nf_hook_ops *reg)
>  {
> -	struct list_head *hook_list = NULL;
> +	struct nf_hook_entry *hook_list = NULL;
>  
>  	if (reg->pf != NFPROTO_NETDEV)
> -		hook_list = &net->nf.hooks[reg->pf][reg->hooknum];
> +		hook_list = rcu_dereference(net->nf.hooks[reg->pf]
> +					    [reg->hooknum]);
>  	else if (reg->hooknum == NF_NETDEV_INGRESS) {
>  #ifdef CONFIG_NETFILTER_INGRESS
>  		if (reg->dev && dev_net(reg->dev) == net)
> -			hook_list = &reg->dev->nf_hooks_ingress;
> +			hook_list =
> +				rcu_dereference(reg->dev->nf_hooks_ingress);

Both of these should use nf_entry_dereference() to avoid the lockdep
splat reported by kbuild robot:

net/netfilter/core.c:75 suspicious rcu_dereference_check() usage!
2 locks held by swapper/1:
#0:  (rtnl_mutex){+.+.+.}, at: [<ffffffff81c2e567>] rtnl_lock+0x17/0x20
#1:  (nf_hook_mutex){+.+...}, at: [<ffffffff81c58fcb>] nf_register_net_hook+0xcb/0x240

  reply	other threads:[~2016-07-08 23:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 21:19 [PATCH nf-next 0/3] Compact netfilter hooks list Aaron Conole
2016-06-30 21:19 ` [PATCH nf-next 1/3] netfilter: bridge: add and use br_nf_hook_thresh Aaron Conole
2016-06-30 21:19 ` [PATCH nf-next 2/3] netfilter: call nf_hook_state_init with rcu_read_lock held Aaron Conole
2016-06-30 21:19 ` [PATCH nf-next 3/3] netfilter: replace list_head with single linked list Aaron Conole
2016-07-08 23:30   ` Florian Westphal [this message]
2016-07-11 10:29     ` Pablo Neira Ayuso
2016-07-11 18:56     ` 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=20160708233038.GA2067@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=aconole@bytheb.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.