Unverified Commit 46a8fcfc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11137 netfilter: nf_tables: unregister flowtable hooks on netns exit

parents fe62b8cd 68682f60
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -9135,16 +9135,24 @@ int __nft_release_basechain(struct nft_ctx *ctx)
}
EXPORT_SYMBOL_GPL(__nft_release_basechain);

static void __nft_release_hooks(struct net *net)
static void __nft_release_hook(struct net *net, struct nft_table *table)
{
	struct nftables_pernet *nft_net = net_generic(net, nf_tables_net_id);
	struct nft_table *table;
	struct nft_flowtable *flowtable;
	struct nft_chain *chain;

	list_for_each_entry(table, &nft_net->tables, list) {
	list_for_each_entry(chain, &table->chains, list)
		nf_tables_unregister_hook(net, table, chain);
	list_for_each_entry(flowtable, &table->flowtables, list)
		nft_unregister_flowtable_net_hooks(net, &flowtable->hook_list);
}

static void __nft_release_hooks(struct net *net)
{
	struct nftables_pernet *nft_net = net_generic(net, nf_tables_net_id);
	struct nft_table *table;

	list_for_each_entry(table, &nft_net->tables, list)
		__nft_release_hook(net, table);
}

static void __nft_release_table(struct net *net, struct nft_table *table)