[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20260119154647.74488dc43aee1be8cba48135@linux-foundation.org>
Date: Mon, 19 Jan 2026 15:46:47 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
Cc: mporter@...nel.crashing.org, alex.bou9@...il.com,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] rapidio: replace rio_free_net() with kfree() in
rio_scan_alloc_net()
On Wed, 17 Dec 2025 17:15:48 +0800 Haoxiang Li <lihaoxiang@...c.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@...r.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
Reviewed-by: Andrew Morton <akpm@...ux-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.
Powered by blists - more mailing lists