All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: highbank: Fix refcount leak in highbank_init
@ 2022-05-12  3:12 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-05-12  3:12 UTC (permalink / raw)
  To: Andre Przywara, Russell King, Rob Herring, Jamie Iles, Shawn Guo,
	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: 220e6cf7b793 ("ARM: add Highbank core platform support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-highbank/highbank.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index db607955a7e4..af9488854fe3 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -142,6 +142,7 @@ static void __init highbank_init(void)
 	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
+	of_node_put(np);
 
 	pm_power_off = highbank_power_off;
 	highbank_pm_init();
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ARM: highbank: Fix refcount leak in highbank_init
@ 2022-05-12  3:12 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-05-12  3:12 UTC (permalink / raw)
  To: Andre Przywara, Russell King, Rob Herring, Jamie Iles, Shawn Guo,
	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: 220e6cf7b793 ("ARM: add Highbank core platform support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-highbank/highbank.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index db607955a7e4..af9488854fe3 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -142,6 +142,7 @@ static void __init highbank_init(void)
 	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
+	of_node_put(np);
 
 	pm_power_off = highbank_power_off;
 	highbank_pm_init();
-- 
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] 4+ messages in thread

* Re: [PATCH] ARM: highbank: Fix refcount leak in highbank_init
  2022-05-12  3:12 ` Miaoqian Lin
@ 2022-05-12  7:56   ` Andre Przywara
  -1 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2022-05-12  7:56 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Russell King, Rob Herring, Jamie Iles, Shawn Guo,
	linux-arm-kernel, linux-kernel, Arnd Bergmann, Olof Johansson

On Thu, 12 May 2022 07:12:58 +0400
Miaoqian Lin <linmq006@gmail.com> wrote:

Hi,

> 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: 220e6cf7b793 ("ARM: add Highbank core platform support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

That is basically the same patch as this one:
https://lore.kernel.org/linux-arm-kernel/20220408094817.2494756-1-lv.ruyi@zte.com.cn/

Arnd, Olof, can you please take the older one through the soc tree? Maybe
adding the Fixes tag from this one?

Thanks,
Andre

> ---
>  arch/arm/mach-highbank/highbank.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
> index db607955a7e4..af9488854fe3 100644
> --- a/arch/arm/mach-highbank/highbank.c
> +++ b/arch/arm/mach-highbank/highbank.c
> @@ -142,6 +142,7 @@ static void __init highbank_init(void)
>  	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
>  	sregs_base = of_iomap(np, 0);
>  	WARN_ON(!sregs_base);
> +	of_node_put(np);
>  
>  	pm_power_off = highbank_power_off;
>  	highbank_pm_init();


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ARM: highbank: Fix refcount leak in highbank_init
@ 2022-05-12  7:56   ` Andre Przywara
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2022-05-12  7:56 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Russell King, Rob Herring, Jamie Iles, Shawn Guo,
	linux-arm-kernel, linux-kernel, Arnd Bergmann, Olof Johansson

On Thu, 12 May 2022 07:12:58 +0400
Miaoqian Lin <linmq006@gmail.com> wrote:

Hi,

> 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: 220e6cf7b793 ("ARM: add Highbank core platform support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

That is basically the same patch as this one:
https://lore.kernel.org/linux-arm-kernel/20220408094817.2494756-1-lv.ruyi@zte.com.cn/

Arnd, Olof, can you please take the older one through the soc tree? Maybe
adding the Fixes tag from this one?

Thanks,
Andre

> ---
>  arch/arm/mach-highbank/highbank.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
> index db607955a7e4..af9488854fe3 100644
> --- a/arch/arm/mach-highbank/highbank.c
> +++ b/arch/arm/mach-highbank/highbank.c
> @@ -142,6 +142,7 @@ static void __init highbank_init(void)
>  	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
>  	sregs_base = of_iomap(np, 0);
>  	WARN_ON(!sregs_base);
> +	of_node_put(np);
>  
>  	pm_power_off = highbank_power_off;
>  	highbank_pm_init();


_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2022-05-12  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  3:12 [PATCH] ARM: highbank: Fix refcount leak in highbank_init Miaoqian Lin
2022-05-12  3:12 ` Miaoqian Lin
2022-05-12  7:56 ` Andre Przywara
2022-05-12  7:56   ` Andre Przywara

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.