netfilter: nf_conncount: speculative garbage collection on empty lists
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 28 Dec 2018 00:24:48 +0000 (01:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 20:40:29 +0000 (21:40 +0100)
commitb01b92417d09b298ec6c29b8b560abced1e2ff97
treec6f34fff64f5040aaa3d62b2780e453141c20363
parentaea1d19594e68d3beaf5cc11e4b5f5b9059abdb7
netfilter: nf_conncount: speculative garbage collection on empty lists

commit c80f10bc973af2ace6b1414724eeff61eaa71837 upstream.

Instead of removing a empty list node that might be reintroduced soon
thereafter, tentatively place the empty list node on the list passed to
tree_nodes_free(), then re-check if the list is empty again before erasing
it from the tree.

[ Florian: rebase on top of pending nf_conncount fixes ]

Fixes: 5c789e131cbb9 ("netfilter: nf_conncount: Add list lock and gc worker, and RCU for init tree search")
Reviewed-by: Shawn Bohrer <sbohrer@cloudflare.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/netfilter/nf_conntrack_count.h
net/netfilter/nf_conncount.c