* [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
@ 2022-05-12 2:58 ` Miaoqian Lin
0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-05-12 2:58 UTC (permalink / raw)
To: Wei Xu, Russell King, Kevin Hilman, Haojian Zhuang, Zhangfei Gao,
linux-arm-kernel, linux-kernel
Cc: linmq006
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);
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
@ 2022-05-12 2:58 ` Miaoqian Lin
0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-05-12 2:58 UTC (permalink / raw)
To: Wei Xu, Russell King, Kevin Hilman, Haojian Zhuang, Zhangfei Gao,
linux-arm-kernel, linux-kernel
Cc: linmq006
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);
}
}
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
2022-05-12 2:58 ` Miaoqian Lin
@ 2022-05-12 3:06 ` Wei Xu
-1 siblings, 0 replies; 6+ messages in thread
From: Wei Xu @ 2022-05-12 3:06 UTC (permalink / raw)
To: Miaoqian Lin, Russell King, Kevin Hilman, Haojian Zhuang,
Zhangfei Gao, linux-arm-kernel, linux-kernel
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);
> }
> }
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
@ 2022-05-12 3:06 ` Wei Xu
0 siblings, 0 replies; 6+ messages in thread
From: Wei Xu @ 2022-05-12 3:06 UTC (permalink / raw)
To: Miaoqian Lin, Russell King, Kevin Hilman, Haojian Zhuang,
Zhangfei Gao, linux-arm-kernel, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
2022-05-12 2:58 ` Miaoqian Lin
@ 2022-05-12 3:09 ` Wei Xu
-1 siblings, 0 replies; 6+ messages in thread
From: Wei Xu @ 2022-05-12 3:09 UTC (permalink / raw)
To: Miaoqian Lin, Russell King, Kevin Hilman, Haojian Zhuang,
Zhangfei Gao, linux-arm-kernel, linux-kernel, xuwei5
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);
> }
> }
>
>
Thanks!
But a similar patch[1] has been applied.
[1]: https://www.spinics.net/lists/arm-kernel/msg975425.html
Best Regards,
Wei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: hisi: Fix refcount leak in hi3xxx_smp_prepare_cpus
@ 2022-05-12 3:09 ` Wei Xu
0 siblings, 0 replies; 6+ messages in thread
From: Wei Xu @ 2022-05-12 3:09 UTC (permalink / raw)
To: Miaoqian Lin, Russell King, Kevin Hilman, Haojian Zhuang,
Zhangfei Gao, linux-arm-kernel, linux-kernel, xuwei5
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);
> }
> }
>
>
Thanks!
But a similar patch[1] has been applied.
[1]: https://www.spinics.net/lists/arm-kernel/msg975425.html
Best Regards,
Wei
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-12 3:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-05-12 3:06 ` Wei Xu
2022-05-12 3:09 ` Wei Xu
2022-05-12 3:09 ` Wei Xu
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.