Skip to content

Commit

Permalink
netfilter: nf_tables: Release memory obtained by kasprintf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arvind Yadav authored and Pablo Neira Ayuso committed Oct 3, 2017
1 parent e6b72ee commit e63aaaa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2741,8 +2741,10 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
list_for_each_entry(i, &ctx->table->sets, list) {
if (!nft_is_active_next(ctx->net, i))
continue;
if (!strcmp(set->name, i->name))
if (!strcmp(set->name, i->name)) {
kfree(set->name);
return -ENFILE;
}
}
return 0;
}
Expand Down

0 comments on commit e63aaaa

Please sign in to comment.