From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] parser_bison: fix memory leak when parsing flowtable hook declaration
Date: Thu, 24 Jul 2025 11:44:14 +0200 [thread overview]
Message-ID: <aIIAbqru_zAWLtFv@calendula> (raw)
In-Reply-To: <20250723150021.10811-1-fw@strlen.de>
On Wed, Jul 23, 2025 at 05:00:11PM +0200, Florian Westphal wrote:
> When the hook location is invalid we error out but we do leak both
> the priority expression and the flowtable name. Example:
>
> valgrind --leak-check=full nft -f flowtable-parser-err-memleak
> [..] Error: unknown chain hook
> hook enoent priority filter + 10
> ^^^^^^
> [..]
> 2 bytes in 1 blocks are definitely lost in loss record 1 of 3
> at: malloc (vg_replace_malloc.c:446)
> by: strdup (in libc.so.6)
> by: xstrdup (in libnftables.so.1.1.0)
> by: nft_lex (in libnftables.so.1.1.0)
> by: nft_parse (in libnftables.so.1.1.0)
> by: __nft_run_cmd_from_filename (in libnftables.so.1.1.0)
> by: nft_run_cmd_from_filename (in libnftables.so.1.1.0)
>
> First two reports are due to the priority expression: this needs to call
> expr_free(). Third report is due to the flowtable name, the destructor
> was missing so add one.
>
> After fix:
> All heap blocks were freed -- no leaks are possible
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Thanks
prev parent reply other threads:[~2025-07-24 9:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <netfilter-devel>
2019-04-30 12:53 ` [PATCH nf] netfilter: nf_tables: fix oops during rule dump Florian Westphal
2019-05-01 3:54 ` Taehee Yoo
2019-05-20 19:21 ` Pablo Neira Ayuso
2022-09-06 15:20 ` [PATCH nf-next 0/2] netfilter: nat: avoid long-running loops Florian Westphal
2022-09-06 15:20 ` [PATCH nf-next 1/2] netfilter: nat: move repetitive nat port reserve loop to a helper Florian Westphal
2022-09-06 15:20 ` [PATCH nf-next 2/2] netfilter: nat: avoid long-running port range loop Florian Westphal
2023-10-06 9:27 ` [PATCH nf-next] netfilter: conntrack: simplify nf_conntrack_alter_reply Florian Westphal
2025-07-23 15:00 ` [PATCH nft] parser_bison: fix memory leak when parsing flowtable hook declaration Florian Westphal
2025-07-24 9:44 ` Pablo Neira Ayuso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aIIAbqru_zAWLtFv@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).