linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register
@ 2022-06-06  6:42 Miaoqian Lin
  2022-07-03  3:56 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-06-06  6:42 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Thara Gopinath, linux-arm-msm, linux-kernel
  Cc: linmq006

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.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/qcom/qcom_aoss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index a59bb34e5eba..18c856056475 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -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)
-- 
2.25.1


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

* Re: [PATCH] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register
  2022-06-06  6:42 [PATCH] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Miaoqian Lin
@ 2022-07-03  3:56 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2022-07-03  3:56 UTC (permalink / raw)
  To: Thara Gopinath, Andy Gross, linux-arm-msm, linux-kernel, Miaoqian Lin

On Mon, 6 Jun 2022 10:42:52 +0400, Miaoqian Lin wrote:
> 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,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>

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

end of thread, other threads:[~2022-07-03  3:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  6:42 [PATCH] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Miaoqian Lin
2022-07-03  3:56 ` Bjorn Andersson

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