Skip to contentSkip to conversation

firmware: Fix refcount leak bug in trusted_foundation

PATCH New Liang He 1 participant 1 message Jun 17, 2022

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 firmware: Fix refcount leak bug in trusted_foundation

In of_register_trusted_foundations(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---
 drivers/firmware/trusted_foundations.c | 1 +
 1 file changed, 1 insertion(+)
drivers/firmware/trusted_foundations.c +1 -0
index 1389fa9418a7..74ef947f5547 100644
@@ -173,6 +173,7 @@ void of_register_trusted_foundations(void)
 		panic("Trusted Foundation: missing version-major property\n");
 	err = of_property_read_u32(node, "tlm,version-minor",
 				   &pdata.version_minor);
+	of_node_put(node);
 	if (err != 0)
 		panic("Trusted Foundation: missing version-minor property\n");
 	register_trusted_foundations(&pdata);
Signature · 1 line
2.25.1