]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: fix racy rule deletion
authorPablo Neira Ayuso <pablo@netfilter.org>
Sat, 25 Jan 2014 13:03:51 +0000 (14:03 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Feb 2014 10:46:06 +0000 (11:46 +0100)
commita62029634c4a2677e90e020c6e13c79b4bb7f78d
tree0e33bf5e9bac4ac772b45d41899ca16024c2ff7e
parent144fee4c638e5cc21c4570024b9183ae730ead22
netfilter: nf_tables: fix racy rule deletion

We may lost race if we flush the rule-set (which happens asynchronously
via call_rcu) and we try to remove the table (that userspace assumes
to be empty).

Fix this by recovering synchronous rule and chain deletion. This was
introduced time ago before we had no batch support, and synchronous
rule deletion performance was not good. Now that we have the batch
support, we can just postpone the purge of old rule in a second step
in the commit phase. All object deletions are synchronous after this
patch.

As a side effect, we save memory as we don't need rcu_head per rule
anymore.

Cc: Patrick McHardy <kaber@trash.net>
Reported-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c