Commit 389a2cbc authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nf_tables: add nft_flowtable_hooks_destroy()

This patch adds a helper function destroy the flowtable hooks.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f9382669
...@@ -6339,6 +6339,16 @@ static int nft_register_flowtable_net_hooks(struct net *net, ...@@ -6339,6 +6339,16 @@ static int nft_register_flowtable_net_hooks(struct net *net,
return err; return err;
} }
static void nft_flowtable_hooks_destroy(struct list_head *hook_list)
{
struct nft_hook *hook, *next;
list_for_each_entry_safe(hook, next, hook_list, list) {
list_del_rcu(&hook->list);
kfree_rcu(hook, rcu);
}
}
static int nf_tables_newflowtable(struct net *net, struct sock *nlsk, static int nf_tables_newflowtable(struct net *net, struct sock *nlsk,
struct sk_buff *skb, struct sk_buff *skb,
const struct nlmsghdr *nlh, const struct nlmsghdr *nlh,
...@@ -6433,10 +6443,7 @@ static int nf_tables_newflowtable(struct net *net, struct sock *nlsk, ...@@ -6433,10 +6443,7 @@ static int nf_tables_newflowtable(struct net *net, struct sock *nlsk,
&flowtable->hook_list, &flowtable->hook_list,
flowtable); flowtable);
if (err < 0) { if (err < 0) {
list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) { nft_flowtable_hooks_destroy(&flowtable->hook_list);
list_del_rcu(&hook->list);
kfree_rcu(hook, rcu);
}
goto err4; goto err4;
} }
......
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