summaryrefslogtreecommitdiff
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-12-28 01:24:44 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-12-29 02:45:19 +0100
commitf7fcc98dfc2d136722007fec0debbed761679b94 (patch)
treeabac7ea27b0b8414e427da2ed4995d1c14a85b80 /drivers/of/base.c
parent4cd273bb91b3001f623f516ec726c49754571b1a (diff)
downloadlinux-f7fcc98dfc2d136722007fec0debbed761679b94.tar.gz
linux-f7fcc98dfc2d136722007fec0debbed761679b94.tar.bz2
linux-f7fcc98dfc2d136722007fec0debbed761679b94.zip
netfilter: nf_conncount: split gc in two phases
The lockless workqueue garbage collector can race with packet path garbage collector to delete list nodes, as it calls tree_nodes_free() with the addresses of nodes that might have been free'd already from another cpu. To fix this, split gc into two phases. One phase to perform gc on the connections: From a locking perspective, this is the same as count_tree(): we hold rcu lock, but we do not change the tree, we only change the nodes' contents. The second phase acquires the tree lock and reaps empty nodes. This avoids a race condition of the garbage collection vs. packet path: If a node has been free'd already, the second phase won't find it anymore. This second phase is, from locking perspective, same as insert_tree(). The former only modifies nodes (list content, count), latter modifies the tree itself (rb_erase or rb_insert). 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>
Diffstat (limited to 'drivers/of/base.c')
0 files changed, 0 insertions, 0 deletions