Skip to content

Commit cc7c6e0

Browse files
ummakynesgregkh
authored andcommitted
netfilter: nf_tables: hold mutex on netns pre_exit path
commit 3923b1e upstream. clean_net() runs in workqueue while walking over the lists, grab mutex. Fixes: 767d121 ("netfilter: nftables: fix possible UAF over chains from packet path in netns") Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c9a46a3 commit cc7c6e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9892,7 +9892,11 @@ static int __net_init nf_tables_init_net(struct net *net)
98929892

98939893
static void __net_exit nf_tables_pre_exit_net(struct net *net)
98949894
{
9895+
struct nftables_pernet *nft_net = nft_pernet(net);
9896+
9897+
mutex_lock(&nft_net->commit_mutex);
98959898
__nft_release_hooks(net);
9899+
mutex_unlock(&nft_net->commit_mutex);
98969900
}
98979901

98989902
static void __net_exit nf_tables_exit_net(struct net *net)

0 commit comments

Comments
 (0)