From: Andrew Morton <akpm@linux-foundation.org>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: mporter@kernel.crashing.org, alex.bou9@gmail.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] rapidio: replace rio_free_net() with kfree() in rio_scan_alloc_net()
Date: Mon, 19 Jan 2026 15:46:47 -0800 [thread overview]
Message-ID: <20260119154647.74488dc43aee1be8cba48135@linux-foundation.org> (raw)
In-Reply-To: <20251217091548.482358-1-lihaoxiang@isrc.iscas.ac.cn>
On Wed, 17 Dec 2025 17:15:48 +0800 Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn> wrote:
> When idtab allocation fails, net is not registered with rio_add_net()
> yet, so kfree(net) is sufficient to release the memory.
>
> Fixes: e6b585ca6e81 ("rapidio: move net allocation into core code")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
> --- a/drivers/rapidio/rio-scan.c
> +++ b/drivers/rapidio/rio-scan.c
> @@ -854,7 +854,7 @@ static struct rio_net *rio_scan_alloc_net(struct rio_mport *mport,
>
> if (idtab == NULL) {
> pr_err("RIO: failed to allocate destID table\n");
> - rio_free_net(net);
> + kfree(net);
> net = NULL;
> } else {
> net->enum_data = idtab;
An existing issue I see: if this error path is taken, mport->net is
left pointing at freed memory. I don't know if this is a bug, but it
seems sloppy.
prev parent reply other threads:[~2026-01-19 23:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 9:15 Haoxiang Li
2026-01-19 23:46 ` Andrew Morton [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=20260119154647.74488dc43aee1be8cba48135@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=alex.bou9@gmail.com \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=mporter@kernel.crashing.org \
--cc=stable@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®