Skip to content

Commit cbc7233

Browse files
committed
netfilter: nf_tables: GC transaction race with netns dismantle
jira VUlN-597 subsystem-sync netfilter:nf_tables 4.18.0-511 commit-author Pablo Neira Ayuso <[email protected]> commit 02c6c24 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 <[email protected]> Signed-off-by: Florian Westphal <[email protected]> (cherry picked from commit 02c6c24) Signed-off-by: Greg Rose <[email protected]>
1 parent 4942471 commit cbc7233

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
@@ -7903,9 +7903,14 @@ struct nft_trans_gc *nft_trans_gc_alloc(struct nft_set *set,
79037903
if (!trans)
79047904
return NULL;
79057905

7906+
trans->net = maybe_get_net(net);
7907+
if (!trans->net) {
7908+
kfree(trans);
7909+
return NULL;
7910+
}
7911+
79067912
refcount_inc(&set->refs);
79077913
trans->set = set;
7908-
trans->net = get_net(net);
79097914
trans->seq = gc_seq;
79107915

79117916
return trans;

0 commit comments

Comments
 (0)