Commit cc7c6e0a authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Greg Kroah-Hartman
Browse files

netfilter: nf_tables: hold mutex on netns pre_exit path



commit 3923b1e4 upstream.

clean_net() runs in workqueue while walking over the lists, grab mutex.

Fixes: 767d1216 ("netfilter: nftables: fix possible UAF over chains from packet path in netns")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9a46a3d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -9892,7 +9892,11 @@ static int __net_init nf_tables_init_net(struct net *net)

static void __net_exit nf_tables_pre_exit_net(struct net *net)
{
	struct nftables_pernet *nft_net = nft_pernet(net);

	mutex_lock(&nft_net->commit_mutex);
	__nft_release_hooks(net);
	mutex_unlock(&nft_net->commit_mutex);
}

static void __net_exit nf_tables_exit_net(struct net *net)