Skip to content

Commit f2a489f

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 c88f3e3 commit f2a489f

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
@@ -9813,7 +9813,11 @@ static int __net_init nf_tables_init_net(struct net *net)
98139813

98149814
static void __net_exit nf_tables_pre_exit_net(struct net *net)
98159815
{
9816+
struct nftables_pernet *nft_net = nft_pernet(net);
9817+
9818+
mutex_lock(&nft_net->commit_mutex);
98169819
__nft_release_hooks(net);
9820+
mutex_unlock(&nft_net->commit_mutex);
98179821
}
98189822

98199823
static void __net_exit nf_tables_exit_net(struct net *net)

0 commit comments

Comments
 (0)