Skip to contentSkip to conversation

soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register

PATCH Applied Miaoqian Lin 2 participants 2 messages Jun 6, 2022 – Jul 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register

Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node.
When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak.

Fixes 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.")
---
 drivers/soc/qcom/qcom_aoss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +3 -1
index a59bb34e5eba..18c856056475 100644
@@ -399,8 +399,10 @@ static int qmp_cooling_devices_register(struct qmp *qmp)
 			continue;
 		ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++],
 					     child);
-		if (ret)
+		if (ret) {
+			of_node_put(child);
 			goto unroll;
+		}
 	}
 
 	if (!count)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Miaoqian Lin

Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node.
When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak.

[...]

Applied, thanks!

[1/1] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register

      commit: e6e0951414a314e7db3e9e24fd924b3e15515288

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>