Skip to contentSkip to conversation

HSI: omap_ssi: Fix refcount leak in ssi_probe

PATCH In review Miaoqian Lin 2 participants 2 messages Apr 4, 2022 – Apr 12, 2022 HSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HSI: omap_ssi: Fix refcount leak in ssi_probe

When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node.

Fixes b209e047bc74 ("HSI: Introduce OMAP SSI driver")
---
 drivers/hsi/controllers/omap_ssi_core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hsi/controllers/omap_ssi_core.c +1 -0
index 44a3f5660c10..eb9820158318 100644
@@ -524,6 +524,7 @@ static int ssi_probe(struct platform_device *pd)
 		if (!childpdev) {
 			err = -ENODEV;
 			dev_err(&pd->dev, "failed to create ssi controller port\n");
+			of_node_put(child);
 			goto out3;
 		}
 	}
Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 7 lines · Miaoqian Lin

When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node.

Fixes b209e047bc74 ("HSI: Introduce OMAP SSI driver")

---

Thanks, queued.

-- Sebastian

Quoted 18 lines
 drivers/hsi/controllers/omap_ssi_core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hsi/controllers/omap_ssi_core.c +1 -0
index 44a3f5660c10..eb9820158318 100644
@@ -524,6 +524,7 @@ static int ssi_probe(struct platform_device *pd)
 		if (!childpdev) {
 			err = -ENODEV;
 			dev_err(&pd->dev, "failed to create ssi controller port\n");
+			of_node_put(child);
 			goto out3;
 		}
 	}
Signature · 1 line
2.17.1