hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/netfilter/nft_dynset.c
....@@ -11,6 +11,9 @@
1111 #include <linux/netfilter/nf_tables.h>
1212 #include <net/netfilter/nf_tables.h>
1313 #include <net/netfilter/nf_tables_core.h>
14
+#include <net/netns/generic.h>
15
+
16
+extern unsigned int nf_tables_net_id;
1417
1518 struct nft_dynset {
1619 struct nft_set *set;
....@@ -106,13 +109,14 @@
106109 const struct nft_expr *expr,
107110 const struct nlattr * const tb[])
108111 {
112
+ struct nftables_pernet *nft_net = net_generic(ctx->net, nf_tables_net_id);
109113 struct nft_dynset *priv = nft_expr_priv(expr);
110114 u8 genmask = nft_genmask_next(ctx->net);
111115 struct nft_set *set;
112116 u64 timeout;
113117 int err;
114118
115
- lockdep_assert_held(&ctx->net->nft.commit_mutex);
119
+ lockdep_assert_held(&nft_net->commit_mutex);
116120
117121 if (tb[NFTA_DYNSET_SET_NAME] == NULL ||
118122 tb[NFTA_DYNSET_OP] == NULL ||
....@@ -133,6 +137,9 @@
133137 tb[NFTA_DYNSET_SET_ID], genmask);
134138 if (IS_ERR(set))
135139 return PTR_ERR(set);
140
+
141
+ if (set->flags & NFT_SET_OBJECT)
142
+ return -EOPNOTSUPP;
136143
137144 if (set->ops->update == NULL)
138145 return -EOPNOTSUPP;
....@@ -233,7 +240,7 @@
233240 {
234241 struct nft_dynset *priv = nft_expr_priv(expr);
235242
236
- priv->set->use++;
243
+ nf_tables_activate_set(ctx, priv->set);
237244 }
238245
239246 static void nft_dynset_destroy(const struct nft_ctx *ctx,