Skip to content

Commit 02c6c24

Browse files
ummakynesFlorian Westphal
authored andcommitted
netfilter: nf_tables: GC transaction race with netns dismantle
Use maybe_get_net() since GC workqueue might race with netns exit path. Fixes: 5f68718 ("netfilter: nf_tables: GC transaction API to avoid race with control plane") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fw@strlen.de>
1 parent 6a33d8b commit 02c6c24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9481,9 +9481,14 @@ struct nft_trans_gc *nft_trans_gc_alloc(struct nft_set *set,
94819481
if (!trans)
94829482
return NULL;
94839483

9484+
trans->net = maybe_get_net(net);
9485+
if (!trans->net) {
9486+
kfree(trans);
9487+
return NULL;
9488+
}
9489+
94849490
refcount_inc(&set->refs);
94859491
trans->set = set;
9486-
trans->net = get_net(net);
94879492
trans->seq = gc_seq;
94889493

94899494
return trans;

0 commit comments

Comments
 (0)