From: Quentin Monnet <qmo@kernel.org>
To: Yuan Chen <chenyuan_fl@163.com>,
ast@kernel.org, alexei.starovoitov@gmail.com
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
Yuan Chen <chenyuan@kylinos.cn>
Subject: Re: [PATCH v3] bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure
Date: Fri, 20 Jun 2025 10:00:21 +0100 [thread overview]
Message-ID: <e9f96821-6dc2-4488-b470-199415fc2548@kernel.org> (raw)
In-Reply-To: <20250620012133.14819-1-chenyuan_fl@163.com>
2025-06-20 09:21 UTC+0800 ~ Yuan Chen <chenyuan_fl@163.com>
> From: Yuan Chen <chenyuan@kylinos.cn>
>
> In function dump_xx_nlmsg(), when realloc() fails to allocate memory,
> the original pointer to the buffer is overwritten with NULL. This causes
> a memory leak because the previously allocated buffer becomes unreachable
> without being freed.
>
> Fixes: 7900efc19214 ("tools/bpf: bpftool: improve output format for bpftool net")
> Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Thanks!
next prev parent reply other threads:[~2025-06-20 9:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 3:10 [PATCH] bpftool: Fix memory leak in dump_link_nlmsg " chenyuan
2025-06-19 6:57 ` [PATH v2] bpftool: Fix memory leak in dump_xx_nlmsg " chenyuan
2025-06-19 8:45 ` Quentin Monnet
2025-06-19 15:55 ` Alexei Starovoitov
2025-06-20 1:21 ` [PATCH v3] " Yuan Chen
2025-06-20 9:00 ` Quentin Monnet [this message]
2025-06-20 18:40 ` patchwork-bot+netdevbpf
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=e9f96821-6dc2-4488-b470-199415fc2548@kernel.org \
--to=qmo@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyuan@kylinos.cn \
--cc=chenyuan_fl@163.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®