Skip to content

Commit 3923b1e

Browse files
committed
netfilter: nf_tables: hold mutex on netns pre_exit path
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]>
1 parent fecf31e commit 3923b1e

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

98979897
static void __net_exit nf_tables_pre_exit_net(struct net *net)
98989898
{
9899+
struct nftables_pernet *nft_net = nft_pernet(net);
9900+
9901+
mutex_lock(&nft_net->commit_mutex);
98999902
__nft_release_hooks(net);
9903+
mutex_unlock(&nft_net->commit_mutex);
99009904
}
99019905

99029906
static void __net_exit nf_tables_exit_net(struct net *net)

0 commit comments

Comments
 (0)