Comments
Patch
@@ -1980,6 +1980,9 @@ int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
{
struct nft_set_bind_check_args args;
+ if (!list_empty(&set->bindings) && set->flags & NFT_SET_ANONYMOUS)
+ return -EBUSY;
+
if (set->flags & NFT_SET_MAP) {
args.iter.skip = 0;
args.iter.count = 0;
@@ -1988,8 +1991,13 @@ int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
args.ctx = ctx;
set->ops->walk(set, &args.iter);
- if (args.iter.err < 0)
+ if (args.iter.err < 0) {
+ /* Destroy anonymous sets if binding fails */
+ if (set->flags & NFT_SET_ANONYMOUS)
+ nf_tables_set_destroy(ctx, set);
+
return args.iter.err;
+ }
}
binding->chain = ctx->chain;