diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-09-20 03:01:28 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-03 09:21:19 -0400 |
commit | e63aaaa6be54c956b9603590ea436b003407bb3e (patch) | |
tree | 41dc24bdde20c418bfeac618d2f2aa910f374f40 | |
parent | e6b72ee88a56bcfe63f72e9c30766484c45bec72 (diff) |
netfilter: nf_tables: Release memory obtained by kasprintf
Free memory region, if nf_tables_set_alloc_name is not successful.
Fixes: 387454901bd6 ("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>
-rw-r--r-- | net/netfilter/nf_tables_api.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index f98ca8c6aa59..34adedcb239e 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -2741,8 +2741,10 @@ cont: | |||
2741 | list_for_each_entry(i, &ctx->table->sets, list) { | 2741 | list_for_each_entry(i, &ctx->table->sets, list) { |
2742 | if (!nft_is_active_next(ctx->net, i)) | 2742 | if (!nft_is_active_next(ctx->net, i)) |
2743 | continue; | 2743 | continue; |
2744 | if (!strcmp(set->name, i->name)) | 2744 | if (!strcmp(set->name, i->name)) { |
2745 | kfree(set->name); | ||
2745 | return -ENFILE; | 2746 | return -ENFILE; |
2747 | } | ||
2746 | } | 2748 | } |
2747 | return 0; | 2749 | return 0; |
2748 | } | 2750 | } |