linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting
@ 2019-10-20  1:57 Chris Goldsworthy
  2019-10-21  2:06 ` Bjorn Andersson
  2019-10-23 20:14 ` Rob Herring
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Goldsworthy @ 2019-10-20  1:57 UTC (permalink / raw)
  To: robh+dt
  Cc: Chris Goldsworthy, devicetree, stable, linux-kernel,
	linux-arm-msm, linux-arm-kernel

Commit d698a388146c ("of: reserved-memory: ignore disabled memory-region
nodes") added an early return in of_reserved_mem_device_init_by_idx(), but
didn't call of_node_put() on a device_node whose ref-count was incremented
in the call to of_parse_phandle() preceding the early exit.

Fixes: d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes")
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
To: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 7989703..6bd610e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
 	if (!target)
 		return -ENODEV;
 
-	if (!of_device_is_available(target))
+	if (!of_device_is_available(target)) {
+		of_node_put(target);
 		return 0;
+	}
 
 	rmem = __find_rmem(target);
 	of_node_put(target);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting
  2019-10-20  1:57 [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting Chris Goldsworthy
@ 2019-10-21  2:06 ` Bjorn Andersson
  2019-10-21  3:34   ` cgoldswo
  2019-10-23 20:14 ` Rob Herring
  1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Andersson @ 2019-10-21  2:06 UTC (permalink / raw)
  To: Chris Goldsworthy
  Cc: robh+dt, devicetree, stable, linux-kernel, linux-arm-msm,
	linux-arm-kernel

On Sat 19 Oct 18:57 PDT 2019, Chris Goldsworthy wrote:

> Commit d698a388146c ("of: reserved-memory: ignore disabled memory-region
> nodes") added an early return in of_reserved_mem_device_init_by_idx(), but
> didn't call of_node_put() on a device_node whose ref-count was incremented
> in the call to of_parse_phandle() preceding the early exit.
> 
> Fixes: d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes")
> Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
> To: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: stable@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org

Cc stable@ is used to assist in making sure your patch is backported to
stable kernels, other than that the purpose Cc here is to indicate that
specific people have been requested to comment on your patch.

So please skip these from the commit message in the future (for this
one, wait and see if Rob is willing to trim them as he applies the
patch).


Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/of/of_reserved_mem.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 7989703..6bd610e 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
>  	if (!target)
>  		return -ENODEV;
>  
> -	if (!of_device_is_available(target))
> +	if (!of_device_is_available(target)) {
> +		of_node_put(target);
>  		return 0;
> +	}
>  
>  	rmem = __find_rmem(target);
>  	of_node_put(target);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

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

* Re: [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting
  2019-10-21  2:06 ` Bjorn Andersson
@ 2019-10-21  3:34   ` cgoldswo
  0 siblings, 0 replies; 5+ messages in thread
From: cgoldswo @ 2019-10-21  3:34 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: devicetree, linux-arm-msm, linux-kernel, stable, robh+dt,
	linux-arm-kernel

Hi Bjorn,

On 2019-10-20 19:06, Bjorn Andersson wrote:
> Cc stable@ is used to assist in making sure your patch is backported to
> stable kernels, other than that the purpose Cc here is to indicate that
> specific people have been requested to comment on your patch.
> 
> So please skip these from the commit message in the future

Thanks for informing me of this, I've re-read the patch submission
documentation and will omit the Cc's in the future from the commit
message (other than Cc stable@).

Regards,

Chris.

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

* Re: [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting
  2019-10-20  1:57 [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting Chris Goldsworthy
  2019-10-21  2:06 ` Bjorn Andersson
@ 2019-10-23 20:14 ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2019-10-23 20:14 UTC (permalink / raw)
  To: Chris Goldsworthy
  Cc: robh+dt, Chris Goldsworthy, devicetree, stable, linux-kernel,
	linux-arm-msm, linux-arm-kernel

On Sat, 19 Oct 2019 18:57:24 -0700, Chris Goldsworthy wrote:
> Commit d698a388146c ("of: reserved-memory: ignore disabled memory-region
> nodes") added an early return in of_reserved_mem_device_init_by_idx(), but
> didn't call of_node_put() on a device_node whose ref-count was incremented
> in the call to of_parse_phandle() preceding the early exit.
> 
> Fixes: d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes")
> Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
> To: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: stable@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/of/of_reserved_mem.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Applied, thanks.

Rob

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

* [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting
@ 2019-09-26 22:48 Chris Goldsworthy
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Goldsworthy @ 2019-09-26 22:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Chris Goldsworthy, devicetree, stable, linux-kernel, linux-arm-kernel

Commit d698a388146c ("of: reserved-memory: ignore disabled memory-region
nodes") added an early return in of_reserved_mem_device_init_by_idx(), but
didn't call of_node_put() on a device_node whose ref-count was incremented
in the call to of_parse_phandle() preceding the early exit.

Fixes: d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes")
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
To: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 7989703..6bd610e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
 	if (!target)
 		return -ENODEV;
 
-	if (!of_device_is_available(target))
+	if (!of_device_is_available(target)) {
+		of_node_put(target);
 		return 0;
+	}
 
 	rmem = __find_rmem(target);
 	of_node_put(target);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

end of thread, other threads:[~2019-10-23 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20  1:57 [PATCH] of: reserved_mem: add missing of_node_put() for proper ref-counting Chris Goldsworthy
2019-10-21  2:06 ` Bjorn Andersson
2019-10-21  3:34   ` cgoldswo
2019-10-23 20:14 ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2019-09-26 22:48 Chris Goldsworthy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).