The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: cgel.zte@gmail.com
Cc: joro@8bytes.org, will@kernel.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	Minghao Chi <chi.minghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] iommu/ipmmu-vmsa: Avoid leak OF node on error
Date: Mon, 23 May 2022 13:54:04 +0200	[thread overview]
Message-ID: <Yot13L7XgvxTkgnE@hovoldconsulting.com> (raw)
In-Reply-To: <20220523111145.2976-1-chi.minghao@zte.com.cn>

On Mon, May 23, 2022 at 11:11:45AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> The OF node should be put before returning error in ipmmu_init(),
> otherwise node's refcount will be leaked.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/iommu/ipmmu-vmsa.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 8fdb84b3642b..f6440b106f46 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -1179,11 +1179,10 @@ static int __init ipmmu_init(void)
>  		return 0;
>  
>  	np = of_find_matching_node(NULL, ipmmu_of_ids);
> +	of_node_put(np);
>  	if (!np)
>  		return 0;
>  
> -	of_node_put(np);
> -
>  	ret = platform_driver_register(&ipmmu_driver);
>  	if (ret < 0)
>  		return ret;

NAK

  reply	other threads:[~2022-05-23 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 11:11 [PATCH] iommu/ipmmu-vmsa: Avoid leak OF node on error cgel.zte
2022-05-23 11:54 ` Johan Hovold [this message]
2022-05-23 13:10   ` Robin Murphy

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=Yot13L7XgvxTkgnE@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=zealci@zte.com.cn \
    /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