Skip to content

Commit e63aaaa

Browse files
ArvindYadavCsummakynes
authored andcommitted
netfilter: nf_tables: Release memory obtained by kasprintf
Free memory region, if nf_tables_set_alloc_name is not successful. Fixes: 3874549 ("netfilter: nf_tables: Allow set names of up to 255 chars") Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent e6b72ee commit e63aaaa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2741,8 +2741,10 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
27412741
list_for_each_entry(i, &ctx->table->sets, list) {
27422742
if (!nft_is_active_next(ctx->net, i))
27432743
continue;
2744-
if (!strcmp(set->name, i->name))
2744+
if (!strcmp(set->name, i->name)) {
2745+
kfree(set->name);
27452746
return -ENFILE;
2747+
}
27462748
}
27472749
return 0;
27482750
}

0 commit comments

Comments
 (0)