[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220622164810.GB1606016@p14s>
Date: Wed, 22 Jun 2022 10:48:10 -0600
From: Mathieu Poirier <mathieu.poirier@...aro.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Bjorn Andersson <bjorn.andersson@...aro.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Peng Fan <peng.fan@....com>,
Oleksij Rempel <linux@...pel-privat.de>,
linux-remoteproc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] remoteproc: imx_rproc: Fix refcount leak in
imx_rproc_addr_init
On Thu, May 12, 2022 at 08:55:58AM +0400, Miaoqian Lin wrote:
> of_parse_phandle() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not needed anymore.
> This function has two paths missing of_node_put().
>
> Fixes: 6e962bfe56b9 ("remoteproc: imx_rproc: add missing of_node_put")
> Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> drivers/remoteproc/imx_rproc.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 7a096f1891e6..6363ed40854a 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -559,16 +559,17 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
>
> node = of_parse_phandle(np, "memory-region", a);
> /* Not map vdevbuffer, vdevring region */
> - if (!strncmp(node->name, "vdev", strlen("vdev")))
> + if (!strncmp(node->name, "vdev", strlen("vdev"))) {
> + of_node_put(node);
> continue;
> + }
> err = of_address_to_resource(node, 0, &res);
> + of_node_put(node);
Applied.
Thanks,
Mathieu
> if (err) {
> dev_err(dev, "unable to resolve memory region\n");
> return err;
> }
>
> - of_node_put(node);
> -
> if (b >= IMX_RPROC_MEM_MAX)
> break;
>
> --
> 2.25.1
>
Powered by blists - more mailing lists