summary refs log tree commit diff
diff options
context:
space:
mode:
authorKunihiko Hayashi <hayashi.kunihiko@socionext.com>2023-06-02 11:05:02 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-21 16:00:51 +0200
commit628e40a225a015cb87bbbcb6cd55bc48c44f615b (patch)
treeb24b8bdedb3917cd22ce7562a208e1d1189d454f
parente01fc7caac9ce9ad76df9f42f7f61ef4bf1d27c9 (diff)
downloadlinux-628e40a225a015cb87bbbcb6cd55bc48c44f615b.tar.gz
of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset()
[ Upstream commit 39affd1fdf65983904fafc07cf607cff737eaf30 ]

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>
Link: https://lore.kernel.org/r/20230602020502.11693-1-hayashi.kunihiko@socionext.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/of/overlay.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index ed4e6c144a68..5289975bad70 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;
 		}