linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>, Peng Fan <peng.fan@nxp.com>,
	Oleksij Rempel <linux@rempel-privat.de>,
	linux-remoteproc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init
Date: Wed, 22 Jun 2022 10:48:10 -0600	[thread overview]
Message-ID: <20220622164810.GB1606016@p14s> (raw)
In-Reply-To: <20220512045558.7142-1-linmq006@gmail.com>

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@gmail.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
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2022-06-22 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12  4:55 [PATCH] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init Miaoqian Lin
2022-06-22 16:48 ` Mathieu Poirier [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=20220622164810.GB1606016@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linmq006@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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).