From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/1] netfilter: ipset: Fix set:list type crash when flush/dump set in parallel
Date: Mon, 29 Feb 2016 13:22:18 +0100 [thread overview]
Message-ID: <20160229122218.GA12101@salvia> (raw)
In-Reply-To: <1456345166-23605-2-git-send-email-kadlec@blackhole.kfki.hu>
On Wed, Feb 24, 2016 at 09:19:26PM +0100, Jozsef Kadlecsik wrote:
> Flushing/listing entries was not RCU safe, so parallel flush/dump
> could lead to kernel crash. Bug reported by Deniz Eren.
>
> Fixes netfilter bugzilla id #1050.
>
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> ---
> net/netfilter/ipset/ip_set_core.c | 3 ++
> net/netfilter/ipset/ip_set_list_set.c | 55 ++++++++++++++++-------------------
> 2 files changed, 28 insertions(+), 30 deletions(-)
>
> diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> index 95db43f..7e6568c 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -985,6 +985,9 @@ static int ip_set_destroy(struct net *net, struct sock *ctnl,
> if (unlikely(protocol_failed(attr)))
> return -IPSET_ERR_PROTOCOL;
>
> + /* Must wait for flush to be really finished in list:set */
> + rcu_barrier();
Jozsef, are you sure you need this rcu_barrier()?
This is waiting for rcu callback completion (ie. decrement the set
reference counter and releasing the extension and object itself).
The rcu read side should be safe when accessing old copies from the
dumping path when using call_rcu().
Let me know, thanks!
next prev parent reply other threads:[~2016-02-29 12:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 20:19 [PATCH 0/1] ipset patch for nf Jozsef Kadlecsik
2016-02-24 20:19 ` [PATCH 1/1] netfilter: ipset: Fix set:list type crash when flush/dump set in parallel Jozsef Kadlecsik
2016-02-29 12:22 ` Pablo Neira Ayuso [this message]
2016-02-29 12:47 ` Jozsef Kadlecsik
2016-03-05 12:32 ` Pablo Neira Ayuso
2016-03-08 19:27 ` Jozsef Kadlecsik
2016-03-10 18:27 ` Pablo Neira Ayuso
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=20160229122218.GA12101@salvia \
--to=pablo@netfilter.org \
--cc=kadlec@blackhole.kfki.hu \
--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 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).