mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thermal: thermal_of: fix OF node leak in thermal_of_for_each_cooling_device()
@ 2026-11-27  7:42 zhaofeng2
  2026-11-27  7:57 ` Lukasz Luba
  0 siblings, 1 reply; 2+ messages in thread
From: zhaofeng2 @ 2026-11-27  7:42 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Zhao Feng, linux-pm, linux-kernel

From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>

thermal_of_for_each_cooling_device() calls of_parse_phandle()
to obtain tr_np, uses it only to call of_find_trip_id(), and
then leaks it on every subsequent return path.

Drop the reference with of_node_put() once the node is no
longer needed.

Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
---
Verified against current tree. Leak found by code inspection
(OF reference-counting audit of thermal_of_for_each_cooling_device()).

 thermal/thermal_of.c | 1 +-++
 1 file changed, 1 insertion(+), 0 deletion(-)

--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -365,6 +365,7 @@
 		return -ENODEV;
 
 	trip_id = of_find_trip_id(tz_np, tr_np);
+	of_node_put(tr_np);
 	if (trip_id < 0)
 		return trip_id;
 



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

* Re: [PATCH] thermal: thermal_of: fix OF node leak in thermal_of_for_each_cooling_device()
  2026-11-27  7:42 [PATCH] thermal: thermal_of: fix OF node leak in thermal_of_for_each_cooling_device() zhaofeng2
@ 2026-11-27  7:57 ` Lukasz Luba
  0 siblings, 0 replies; 2+ messages in thread
From: Lukasz Luba @ 2026-11-27  7:57 UTC (permalink / raw)
  To: zhaofeng2; +Cc: linux-pm, linux-kernel, Daniel Lezcano



On 11/27/26 07:42, zhaofeng2@cmss.chinamobile.com wrote:
> From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> 
> thermal_of_for_each_cooling_device() calls of_parse_phandle()
> to obtain tr_np, uses it only to call of_find_trip_id(), and
> then leaks it on every subsequent return path.
> 
> Drop the reference with of_node_put() once the node is no
> longer needed.
> 
> Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> ---
> Verified against current tree. Leak found by code inspection
> (OF reference-counting audit of thermal_of_for_each_cooling_device()).

This function doesn't exist anymore. I has been removed with
94c6110b0b13c64161

> 
>   thermal/thermal_of.c | 1 +-++
>   1 file changed, 1 insertion(+), 0 deletion(-)
> 
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -365,6 +365,7 @@
>   		return -ENODEV;
>   
>   	trip_id = of_find_trip_id(tz_np, tr_np);
> +	of_node_put(tr_np);
>   	if (trip_id < 0)
>   		return trip_id;
>   
> 
> 
> 


It's not a valid patch.

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

end of thread, other threads:[~2026-11-27  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  7:42 [PATCH] thermal: thermal_of: fix OF node leak in thermal_of_for_each_cooling_device() zhaofeng2
2026-11-27  7:57 ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®