[PATCH] of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset()

Kunihiko Hayashi posted 1 patch 2 years, 8 months ago
drivers/of/overlay.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset()
Posted by Kunihiko Hayashi 2 years, 8 months ago
In init_overlay_changeset(), the variable "node" is from
of_get_child_by_name(), and the "node" should be discarded in error case.

Fixes: d1651b03c2df ("of: overlay: add overlay symbols to live device tree")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/of/overlay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 2e01960f1aeb..7feb643f1370 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -811,6 +811,7 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs)
 		if (!fragment->target) {
 			pr_err("symbols in overlay, but not in live tree\n");
 			ret = -EINVAL;
+			of_node_put(node);
 			goto err_out;
 		}
 
-- 
2.25.1
Re: [PATCH] of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset()
Posted by Rob Herring 2 years, 8 months ago
On Fri, 02 Jun 2023 11:05:02 +0900, Kunihiko Hayashi wrote:
> In init_overlay_changeset(), the variable "node" is from
> of_get_child_by_name(), and the "node" should be discarded in error case.
> 
> Fixes: d1651b03c2df ("of: overlay: add overlay symbols to live device tree")
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  drivers/of/overlay.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Applied, thanks!