linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node
@ 2018-08-27 13:32 zhong jiang
  2018-08-27 16:31 ` Daniel Lezcano
  2018-09-26 15:24 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: zhong jiang @ 2018-08-27 13:32 UTC (permalink / raw)
  To: daniel.lezcano
  Cc: rui.zhang, edubezval, jonathanh, linux-kernel, linux-tegra,
	ezequiel

The function 'for_each_child_of_node' iterates over the node list by
dropping the of_node reference of the previous node.

Calling of_node_put() on the iterator is pointless and leads to an
inconsistent refcounting in addition to a double free. Remove it.

Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
v1->v2: According to Daniel's suggestion. I modify the subject and commit log.

 drivers/thermal/tegra/soctherm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index ed28110..3aa55c9 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -980,7 +980,6 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
 		tcd = thermal_of_cooling_device_register(np_stcc,
 							 (char *)name, ts,
 							 &throt_cooling_ops);
-		of_node_put(np_stcc);
 		if (IS_ERR_OR_NULL(tcd)) {
 			dev_err(dev,
 				"throttle-cfg: %s: failed to register cooling device\n",
-- 
1.7.12.4

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

* Re: [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node
  2018-08-27 13:32 [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node zhong jiang
@ 2018-08-27 16:31 ` Daniel Lezcano
  2018-09-26 15:24 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2018-08-27 16:31 UTC (permalink / raw)
  To: zhong jiang
  Cc: rui.zhang, edubezval, jonathanh, linux-kernel, linux-tegra,
	ezequiel

On 27/08/2018 15:32, zhong jiang wrote:
> The function 'for_each_child_of_node' iterates over the node list by
> dropping the of_node reference of the previous node.
> 
> Calling of_node_put() on the iterator is pointless and leads to an
> inconsistent refcounting in addition to a double free. Remove it.
> 
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> v1->v2: According to Daniel's suggestion. I modify the subject and commit log.
> 
>  drivers/thermal/tegra/soctherm.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
> index ed28110..3aa55c9 100644
> --- a/drivers/thermal/tegra/soctherm.c
> +++ b/drivers/thermal/tegra/soctherm.c
> @@ -980,7 +980,6 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
>  		tcd = thermal_of_cooling_device_register(np_stcc,
>  							 (char *)name, ts,
>  							 &throt_cooling_ops);
> -		of_node_put(np_stcc);
>  		if (IS_ERR_OR_NULL(tcd)) {
>  			dev_err(dev,
>  				"throttle-cfg: %s: failed to register cooling device\n",
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node
  2018-08-27 13:32 [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node zhong jiang
  2018-08-27 16:31 ` Daniel Lezcano
@ 2018-09-26 15:24 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2018-09-26 15:24 UTC (permalink / raw)
  To: zhong jiang
  Cc: daniel.lezcano, rui.zhang, edubezval, jonathanh, linux-kernel,
	linux-tegra, ezequiel

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Mon, Aug 27, 2018 at 09:32:18PM +0800, zhong jiang wrote:
> The function 'for_each_child_of_node' iterates over the node list by
> dropping the of_node reference of the previous node.
> 
> Calling of_node_put() on the iterator is pointless and leads to an
> inconsistent refcounting in addition to a double free. Remove it.
> 
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> v1->v2: According to Daniel's suggestion. I modify the subject and commit log.
> 
>  drivers/thermal/tegra/soctherm.c | 1 -
>  1 file changed, 1 deletion(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-09-26 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-27 13:32 [PATCH v2] drivers/thermal/tegra: Fix a double free on the device node zhong jiang
2018-08-27 16:31 ` Daniel Lezcano
2018-09-26 15:24 ` Thierry Reding

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).