Skip to content

Commit 727722d

Browse files
committed
netfilter: nf_tables: GC transaction race with netns dismantle
JIRA: https://issues.redhat.com/browse/RHEL-1720 JIRA: https://issues.redhat.com/browse/RHEL-1721 Upstream Status: commit 02c6c24 commit 02c6c24 Author: Pablo Neira Ayuso <[email protected]> Date: Tue Aug 15 15:39:01 2023 +0200 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 <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent 58e5f04 commit 727722d

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
@@ -9145,9 +9145,14 @@ struct nft_trans_gc *nft_trans_gc_alloc(struct nft_set *set,
91459145
if (!trans)
91469146
return NULL;
91479147

9148+
trans->net = maybe_get_net(net);
9149+
if (!trans->net) {
9150+
kfree(trans);
9151+
return NULL;
9152+
}
9153+
91489154
refcount_inc(&set->refs);
91499155
trans->set = set;
9150-
trans->net = get_net(net);
91519156
trans->seq = gc_seq;
91529157

91539158
return trans;

0 commit comments

Comments
 (0)