All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
@ 2022-05-26  7:53 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-05-26  7:53 UTC (permalink / raw)
  To: Florian Fainelli, Broadcom Kernel Team, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Andy Shevchenko, Miaoqian Lin, Gareth Powell, Brian Norris,
	Doug Berger, Justin Chen, linux-arm-kernel, linux-kernel

of_find_matching_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

In brcmstb_init_sram, it pass dn to of_address_to_resource(),
of_address_to_resource() will call of_find_device_by_node() to take
reference, so we should release the reference returned by
of_find_matching_node().

Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
index 3cbb165d6e30..70ad0f3dce28 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
@@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev)
 	}
 
 	ret = brcmstb_init_sram(dn);
+	of_node_put(dn);
 	if (ret) {
 		pr_err("error setting up SRAM for PM\n");
 		return ret;
-- 
2.25.1


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

* [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
@ 2022-05-26  7:53 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-05-26  7:53 UTC (permalink / raw)
  To: Florian Fainelli, Broadcom Kernel Team, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Andy Shevchenko, Miaoqian Lin, Gareth Powell, Brian Norris,
	Doug Berger, Justin Chen, linux-arm-kernel, linux-kernel

of_find_matching_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

In brcmstb_init_sram, it pass dn to of_address_to_resource(),
of_address_to_resource() will call of_find_device_by_node() to take
reference, so we should release the reference returned by
of_find_matching_node().

Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
index 3cbb165d6e30..70ad0f3dce28 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
@@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev)
 	}
 
 	ret = brcmstb_init_sram(dn);
+	of_node_put(dn);
 	if (ret) {
 		pr_err("error setting up SRAM for PM\n");
 		return ret;
-- 
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] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
  2022-05-26  7:53 ` Miaoqian Lin
@ 2022-05-26 11:21   ` Andy Shevchenko
  -1 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-05-26 11:21 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Florian Fainelli, Broadcom Kernel Team, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Gareth Powell, Brian Norris, Doug Berger, Justin Chen,
	linux-arm-kernel, linux-kernel

On Thu, May 26, 2022 at 11:53:22AM +0400, Miaoqian Lin wrote:
> of_find_matching_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.
> 
> In brcmstb_init_sram, it pass dn to of_address_to_resource(),
> of_address_to_resource() will call of_find_device_by_node() to take
> reference, so we should release the reference returned by
> of_find_matching_node().

Looks legit,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> index 3cbb165d6e30..70ad0f3dce28 100644
> --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> @@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = brcmstb_init_sram(dn);
> +	of_node_put(dn);
>  	if (ret) {
>  		pr_err("error setting up SRAM for PM\n");
>  		return ret;
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
@ 2022-05-26 11:21   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-05-26 11:21 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Florian Fainelli, Broadcom Kernel Team, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Gareth Powell, Brian Norris, Doug Berger, Justin Chen,
	linux-arm-kernel, linux-kernel

On Thu, May 26, 2022 at 11:53:22AM +0400, Miaoqian Lin wrote:
> of_find_matching_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.
> 
> In brcmstb_init_sram, it pass dn to of_address_to_resource(),
> of_address_to_resource() will call of_find_device_by_node() to take
> reference, so we should release the reference returned by
> of_find_matching_node().

Looks legit,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> index 3cbb165d6e30..70ad0f3dce28 100644
> --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> @@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = brcmstb_init_sram(dn);
> +	of_node_put(dn);
>  	if (ret) {
>  		pr_err("error setting up SRAM for PM\n");
>  		return ret;
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
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] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
  2022-05-26  7:53 ` Miaoqian Lin
@ 2022-06-08  9:21   ` Florian Fainelli
  -1 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2022-06-08  9:21 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, Miaoqian Lin, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Andy Shevchenko, Gareth Powell, Brian Norris, Doug Berger,
	Justin Chen, linux-arm-kernel, linux-kernel

On Thu, 26 May 2022 11:53:22 +0400, Miaoqian Lin <linmq006@gmail.com> wrote:
> of_find_matching_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.
> 
> In brcmstb_init_sram, it pass dn to of_address_to_resource(),
> of_address_to_resource() will call of_find_device_by_node() to take
> reference, so we should release the reference returned by
> of_find_matching_node().
> 
> Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---

Applied to https://github.com/Broadcom/stblinux/commits/drivers/fixes, thanks!
--
Florian

_______________________________________________
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] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
@ 2022-06-08  9:21   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2022-06-08  9:21 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, Miaoqian Lin, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Andy Shevchenko, Gareth Powell, Brian Norris, Doug Berger,
	Justin Chen, linux-arm-kernel, linux-kernel

On Thu, 26 May 2022 11:53:22 +0400, Miaoqian Lin <linmq006@gmail.com> wrote:
> of_find_matching_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.
> 
> In brcmstb_init_sram, it pass dn to of_address_to_resource(),
> of_address_to_resource() will call of_find_device_by_node() to take
> reference, so we should release the reference returned by
> of_find_matching_node().
> 
> Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---

Applied to https://github.com/Broadcom/stblinux/commits/drivers/fixes, thanks!
--
Florian

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

end of thread, other threads:[~2022-06-08  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26  7:53 [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe Miaoqian Lin
2022-05-26  7:53 ` Miaoqian Lin
2022-05-26 11:21 ` Andy Shevchenko
2022-05-26 11:21   ` Andy Shevchenko
2022-06-08  9:21 ` Florian Fainelli
2022-06-08  9:21   ` Florian Fainelli

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.