From: Miaoqian Lin Date: Thu, 26 May 2022 11:06:49 +0000 (+0400) Subject: mtd: partitions: Fix refcount leak in parse_redboot_of X-Git-Tag: v6.1-rc5~689^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f7e62815cf3cbbcb1b8cb21649fb4dfdb3aa016;p=platform%2Fkernel%2Flinux-starfive.git mtd: partitions: Fix refcount leak in parse_redboot_of 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: 237960880960 ("mtd: partitions: redboot: seek fis-index-block in the right node") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gmail.com --- diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index feb44a5..a16b42a 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master) return; ret = of_property_read_u32(npart, "fis-index-block", &dirblock); + of_node_put(npart); if (ret) return;