hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/netfilter/nft_objref.c
....@@ -41,8 +41,10 @@
4141 if (IS_ERR(obj))
4242 return -ENOENT;
4343
44
+ if (!nft_use_inc(&obj->use))
45
+ return -EMFILE;
46
+
4447 nft_objref_priv(expr) = obj;
45
- obj->use++;
4648
4749 return 0;
4850 }
....@@ -71,7 +73,7 @@
7173 if (phase == NFT_TRANS_COMMIT)
7274 return;
7375
74
- obj->use--;
76
+ nft_use_dec(&obj->use);
7577 }
7678
7779 static void nft_objref_activate(const struct nft_ctx *ctx,
....@@ -79,7 +81,7 @@
7981 {
8082 struct nft_object *obj = nft_objref_priv(expr);
8183
82
- obj->use++;
84
+ nft_use_inc_restore(&obj->use);
8385 }
8486
8587 static struct nft_expr_type nft_objref_type;
....@@ -180,7 +182,7 @@
180182 {
181183 struct nft_objref_map *priv = nft_expr_priv(expr);
182184
183
- priv->set->use++;
185
+ nf_tables_activate_set(ctx, priv->set);
184186 }
185187
186188 static void nft_objref_map_destroy(const struct nft_ctx *ctx,