Commit d99407f4 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nft_rbtree: no need for spinlock from set destroy path

The sets are released from the rcu callback, after the rule is removed
from the chain list, which implies that nfnetlink cannot update the
rbtree and no packets are walking on the set anymore. Thus, we can get
rid of the spinlock in the set destroy path there.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Reviewied-by: default avatarThomas Graf <tgraf@suug.ch>
parent 39f39016
...@@ -234,13 +234,11 @@ static void nft_rbtree_destroy(const struct nft_set *set) ...@@ -234,13 +234,11 @@ static void nft_rbtree_destroy(const struct nft_set *set)
struct nft_rbtree_elem *rbe; struct nft_rbtree_elem *rbe;
struct rb_node *node; struct rb_node *node;
spin_lock_bh(&nft_rbtree_lock);
while ((node = priv->root.rb_node) != NULL) { while ((node = priv->root.rb_node) != NULL) {
rb_erase(node, &priv->root); rb_erase(node, &priv->root);
rbe = rb_entry(node, struct nft_rbtree_elem, node); rbe = rb_entry(node, struct nft_rbtree_elem, node);
nft_rbtree_elem_destroy(set, rbe); nft_rbtree_elem_destroy(set, rbe);
} }
spin_unlock_bh(&nft_rbtree_lock);
} }
static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features, static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment