Skip to contentSkip to conversation

remoteproc: qcom_q6v5_pas: fix refcount leak in adsp_alloc_memory_region()

PATCH In review Wang Yufen 2 participants 2 messages Dec 5, 2022

Subsystems (2)
lore
Share & tools
lore

Wang Yufen

author
#0 lore raw

PATCH 1/1 remoteproc: qcom_q6v5_pas: fix refcount leak in adsp_alloc_memory_region()

The node returned by of_parse_phandle() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the end of of_address_to_resource().

Fixes 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
---
 drivers/remoteproc/qcom_q6v5_pas.c | 1 +
 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_q6v5_pas.c +1 -0
index 6afd094..24439a6 100644
@@ -449,6 +449,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
 	}
 
 	ret = of_address_to_resource(node, 0, &r);
+	of_node_put(node);
 	if (ret)
 		return ret;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Wang Yufen

The node returned by of_parse_phandle() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the end of of_address_to_resource().

Fixes 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
---
  drivers/remoteproc/qcom_q6v5_pas.c | 1 +
  1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_q6v5_pas.c +0 -0
index 6afd094..24439a6 100644

drivers/remoteproc/qcom_q6v5_pas.c static int adsp_alloc_memory_region(struct qcom_adsp *adsp) · line 455

Quoted 7 lines
drivers/remoteproc/qcom_q6v5_pas.c +1 -0
@@ -449,6 +449,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
  	}
 
  	ret = of_address_to_resource(node, 0, &r);
+	of_node_put(node);
  	if (ret)
  		return ret;