netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf
@ 2017-09-20  7:01 Arvind Yadav
  2017-10-03 13:21 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-09-20  7:01 UTC (permalink / raw)
  To: pablo, kadlec, fw, davem; +Cc: netfilter-devel, coreteam, netdev, linux-kernel

Free memory region, if nf_tables_set_alloc_name is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 net/netfilter/nf_tables_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 9299271..393e37e 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -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;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf
  2017-09-20  7:01 [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf Arvind Yadav
@ 2017-10-03 13:21 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-03 13:21 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: kadlec, fw, davem, netfilter-devel, coreteam, netdev,
	linux-kernel

On Wed, Sep 20, 2017 at 12:31:28PM +0530, Arvind Yadav wrote:
> Free memory region, if nf_tables_set_alloc_name is not successful.

Applied, thanks.

I have added this tag to this patch:

Fixes: 387454901bd6 ("netfilter: nf_tables: Allow set names of up to 255 chars")

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-03 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20  7:01 [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf Arvind Yadav
2017-10-03 13:21 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).