All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/thermal/tegra: fix a doule free devce node
@ 2018-08-09 13:40 zhong jiang
  2018-08-13 18:30 ` Jon Hunter
  2018-08-14  6:39 ` Daniel Lezcano
  0 siblings, 2 replies; 8+ messages in thread
From: zhong jiang @ 2018-08-09 13:40 UTC (permalink / raw)
  To: ezequiel, daniel.lezcano; +Cc: rui.zhang, edubezval, jonathanh, linux-kernel

Device node iterators will get the return node. Meawhile, It is
also put the previous device node. An explicit put will cause
a double put.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 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] 8+ messages in thread

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-09 13:40 [PATCH] drivers/thermal/tegra: fix a doule free devce node zhong jiang
@ 2018-08-13 18:30 ` Jon Hunter
  2018-08-13 18:35     ` Jon Hunter
  2018-08-14  6:39 ` Daniel Lezcano
  1 sibling, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2018-08-13 18:30 UTC (permalink / raw)
  To: zhong jiang, ezequiel, daniel.lezcano; +Cc: rui.zhang, edubezval, linux-kernel


On 09/08/18 14:40, zhong jiang wrote:
> Device node iterators will get the return node. Meawhile, It is
> also put the previous device node. An explicit put will cause
> a double put.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  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",
> 

Thanks!

Acked-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-13 18:30 ` Jon Hunter
@ 2018-08-13 18:35     ` Jon Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Jon Hunter @ 2018-08-13 18:35 UTC (permalink / raw)
  To: zhong jiang, ezequiel, daniel.lezcano
  Cc: rui.zhang, edubezval, linux-kernel, linux-tegra

Adding linux-tegra ...

On 13/08/18 19:30, Jon Hunter wrote:
> 
> On 09/08/18 14:40, zhong jiang wrote:
>> Device node iterators will get the return node. Meawhile, It is
>> also put the previous device node. An explicit put will cause
>> a double put.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  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",
>>
> 
> Thanks!
> 
> Acked-by: Jon Hunter <jonathanh@nvidia.com>

Just need to fix the typos in the subject and commit log.

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
@ 2018-08-13 18:35     ` Jon Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Jon Hunter @ 2018-08-13 18:35 UTC (permalink / raw)
  To: zhong jiang, ezequiel, daniel.lezcano
  Cc: rui.zhang, edubezval, linux-kernel, linux-tegra

Adding linux-tegra ...

On 13/08/18 19:30, Jon Hunter wrote:
> 
> On 09/08/18 14:40, zhong jiang wrote:
>> Device node iterators will get the return node. Meawhile, It is
>> also put the previous device node. An explicit put will cause
>> a double put.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  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",
>>
> 
> Thanks!
> 
> Acked-by: Jon Hunter <jonathanh@nvidia.com>

Just need to fix the typos in the subject and commit log.

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-09 13:40 [PATCH] drivers/thermal/tegra: fix a doule free devce node zhong jiang
  2018-08-13 18:30 ` Jon Hunter
@ 2018-08-14  6:39 ` Daniel Lezcano
  2018-08-14  6:56   ` zhong jiang
  2018-08-17  2:25   ` zhong jiang
  1 sibling, 2 replies; 8+ messages in thread
From: Daniel Lezcano @ 2018-08-14  6:39 UTC (permalink / raw)
  To: zhong jiang, ezequiel; +Cc: rui.zhang, edubezval, jonathanh, linux-kernel

On 09/08/2018 15:40, zhong jiang wrote:
> Device node iterators will get the return node. Meawhile, It is
> also put the previous device node. An explicit put will cause
> a double put.

What about:

Subject: drivers/thermal/tegra: Fix a double free on the device node

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

> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  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] 8+ messages in thread

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-14  6:39 ` Daniel Lezcano
@ 2018-08-14  6:56   ` zhong jiang
  2018-08-17  2:25   ` zhong jiang
  1 sibling, 0 replies; 8+ messages in thread
From: zhong jiang @ 2018-08-14  6:56 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: ezequiel, rui.zhang, edubezval, jonathanh, linux-kernel

On 2018/8/14 14:39, Daniel Lezcano wrote:
> On 09/08/2018 15:40, zhong jiang wrote:
>> Device node iterators will get the return node. Meawhile, It is
>> also put the previous device node. An explicit put will cause
>> a double put.
> What about:
>
> Subject: drivers/thermal/tegra: Fix a double free on the device node
>
> "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."
 Thank you for doing this. I am sorry for stupid issue.

 Sincerely,
 zhong jiang
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  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",
>>
>



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

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-14  6:39 ` Daniel Lezcano
  2018-08-14  6:56   ` zhong jiang
@ 2018-08-17  2:25   ` zhong jiang
  2018-08-27  8:42     ` Daniel Lezcano
  1 sibling, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-17  2:25 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: ezequiel, rui.zhang, edubezval, jonathanh, linux-kernel

On 2018/8/14 14:39, Daniel Lezcano wrote:
> On 09/08/2018 15:40, zhong jiang wrote:
>> Device node iterators will get the return node. Meawhile, It is
>> also put the previous device node. An explicit put will cause
>> a double put.
> What about:
>
> Subject: drivers/thermal/tegra: Fix a double free on the device node
>
> "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."
 Hi, Daniel

 Have you picked up the patch or should I repost the patch with above commit
 message that you have suggested?

 Thanks,
 zhong jiang
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  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",
>>
>



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

* Re: [PATCH] drivers/thermal/tegra: fix a doule free devce node
  2018-08-17  2:25   ` zhong jiang
@ 2018-08-27  8:42     ` Daniel Lezcano
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Lezcano @ 2018-08-27  8:42 UTC (permalink / raw)
  To: zhong jiang; +Cc: ezequiel, rui.zhang, edubezval, jonathanh, linux-kernel

On 17/08/2018 04:25, zhong jiang wrote:
> On 2018/8/14 14:39, Daniel Lezcano wrote:
>> On 09/08/2018 15:40, zhong jiang wrote:
>>> Device node iterators will get the return node. Meawhile, It is
>>> also put the previous device node. An explicit put will cause
>>> a double put.
>> What about:
>>
>> Subject: drivers/thermal/tegra: Fix a double free on the device node
>>
>> "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."
>  Hi, Daniel
> 
>  Have you picked up the patch or should I repost the patch with above commit
>  message that you have suggested?
> 
>  Thanks,
>  zhong jiang

Hi,

sorry for the delay.

It is not up to me to pick patches for the thermal framework. You should
repost the patch with the suggested commit log above if you agree with.

  -- Daniel

>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>>> ---
>>>  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] 8+ messages in thread

end of thread, other threads:[~2018-08-27  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 13:40 [PATCH] drivers/thermal/tegra: fix a doule free devce node zhong jiang
2018-08-13 18:30 ` Jon Hunter
2018-08-13 18:35   ` Jon Hunter
2018-08-13 18:35     ` Jon Hunter
2018-08-14  6:39 ` Daniel Lezcano
2018-08-14  6:56   ` zhong jiang
2018-08-17  2:25   ` zhong jiang
2018-08-27  8:42     ` Daniel Lezcano

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.