* [PATCH nf-next] netfilter: nf_tables: fix userdata memleak
@ 2020-09-27 8:36 Jose M. Guisado Gomez
2020-09-30 9:59 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Jose M. Guisado Gomez @ 2020-09-27 8:36 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
When userdata was introduced for tables and objects its allocation was
only freed inside the error path of the new{table, object} functions.
Free user data inside corresponding destroy functions for tables and
objects.
Fixes: b131c96496b3 ("netfilter: nf_tables: add userdata support for nft_object")
Fixes: 7a81575b806e ("netfilter: nf_tables: add userdata attributes to nft_table")
Signed-off-by: Jose M. Guisado Gomez <guigom@riseup.net>
---
net/netfilter/nf_tables_api.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 84c0c1aaae99..b3c3c3fc1969 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1211,6 +1211,7 @@ static void nf_tables_table_destroy(struct nft_ctx *ctx)
rhltable_destroy(&ctx->table->chains_ht);
kfree(ctx->table->name);
+ kfree(ctx->table->udata);
kfree(ctx->table);
}
@@ -6231,6 +6232,7 @@ static void nft_obj_destroy(const struct nft_ctx *ctx, struct nft_object *obj)
module_put(obj->ops->type->owner);
kfree(obj->key.name);
+ kfree(obj->udata);
kfree(obj);
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nf-next] netfilter: nf_tables: fix userdata memleak
2020-09-27 8:36 [PATCH nf-next] netfilter: nf_tables: fix userdata memleak Jose M. Guisado Gomez
@ 2020-09-30 9:59 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-09-30 9:59 UTC (permalink / raw)
To: Jose M. Guisado Gomez; +Cc: netfilter-devel
On Sun, Sep 27, 2020 at 10:36:22AM +0200, Jose M. Guisado Gomez wrote:
> When userdata was introduced for tables and objects its allocation was
> only freed inside the error path of the new{table, object} functions.
>
> Free user data inside corresponding destroy functions for tables and
> objects.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-30 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 8:36 [PATCH nf-next] netfilter: nf_tables: fix userdata memleak Jose M. Guisado Gomez
2020-09-30 9:59 ` 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).