提交 ffa4b5ae 编写于 作者: M Miaoqian Lin 提交者: Zheng Zengkai

mtd: partitions: Fix refcount leak in parse_redboot_of

stable inclusion
from stable-v5.10.137
commit 55d0f7da66dec93c4d53d0886a1555618079a900
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=55d0f7da66dec93c4d53d0886a1555618079a900

--------------------------------

[ Upstream commit 9f7e6281 ]

of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: 23796088 ("mtd: partitions: redboot: seek fis-index-block in the right node")
Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gmail.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 d56b9228
...@@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master) ...@@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master)
return; return;
ret = of_property_read_u32(npart, "fis-index-block", &dirblock); ret = of_property_read_u32(npart, "fis-index-block", &dirblock);
of_node_put(npart);
if (ret) if (ret)
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册