From: Wei Xu <xuwei5@hisilicon.com>
To: Miaoqian Lin <linmq006@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Kevin Hilman <khilman@linaro.org>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
Zhangfei Gao <zhangfei.gao@linaro.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
Date: Thu, 12 May 2022 11:06:54 +0800 [thread overview]
Message-ID: <627C79CE.3070402@hisilicon.com> (raw)
In-Reply-To: <20220512025839.50333-1-linmq006@gmail.com>
Hi Miaoqian,
On 2022/5/12 10:58, Miaoqian Lin wrote:
> of_find_compatible_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: a9434e96d9f0 ("ARM: hi3xxx: add smp support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> arch/arm/mach-hisi/platsmp.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
> index a56cc64deeb8..15e63b72df3a 100644
> --- a/arch/arm/mach-hisi/platsmp.c
> +++ b/arch/arm/mach-hisi/platsmp.c
> @@ -68,13 +68,16 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
> ctrl_base = of_iomap(np, 0);
> if (!ctrl_base) {
> pr_err("failed to map address\n");
> + of_node_put(np);
> return;
> }
> if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
> pr_err("failed to find smp-offset property\n");
> + of_node_put(np);
> return;
> }
> ctrl_base += offset;
> + of_node_put(np);
> }
> }
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Wei Xu <xuwei5@hisilicon.com>
To: Miaoqian Lin <linmq006@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Kevin Hilman <khilman@linaro.org>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
Zhangfei Gao <zhangfei.gao@linaro.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
Date: Thu, 12 May 2022 11:06:54 +0800 [thread overview]
Message-ID: <627C79CE.3070402@hisilicon.com> (raw)
In-Reply-To: <20220512025839.50333-1-linmq006@gmail.com>
Hi Miaoqian,
On 2022/5/12 10:58, Miaoqian Lin wrote:
> of_find_compatible_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: a9434e96d9f0 ("ARM: hi3xxx: add smp support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> arch/arm/mach-hisi/platsmp.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
> index a56cc64deeb8..15e63b72df3a 100644
> --- a/arch/arm/mach-hisi/platsmp.c
> +++ b/arch/arm/mach-hisi/platsmp.c
> @@ -68,13 +68,16 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
> ctrl_base = of_iomap(np, 0);
> if (!ctrl_base) {
> pr_err("failed to map address\n");
> + of_node_put(np);
> return;
> }
> if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
> pr_err("failed to find smp-offset property\n");
> + of_node_put(np);
> return;
> }
> ctrl_base += offset;
> + of_node_put(np);
> }
> }
>
>
next prev parent reply other threads:[~2022-05-12 3:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 2:58 [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus Miaoqian Lin
2022-05-12 2:58 ` Miaoqian Lin
2022-05-12 3:06 ` Wei Xu [this message]
2022-05-12 3:06 ` Wei Xu
2022-05-12 3:09 ` Wei Xu
2022-05-12 3:09 ` Wei Xu
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=627C79CE.3070402@hisilicon.com \
--to=xuwei5@hisilicon.com \
--cc=haojian.zhuang@linaro.org \
--cc=khilman@linaro.org \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=zhangfei.gao@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.