]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
mtd: partitions: Fix refcount leak in parse_redboot_of
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 26 May 2022 11:06:49 +0000 (15:06 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:15:53 +0000 (15:15 +0200)
[ Upstream commit 9f7e62815cf3cbbcb1b8cb21649fb4dfdb3aa016 ]

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 <linmq006@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/parsers/redboot.c

index 3ccd6363ee8cba9cd99f2581a4064d0a50ea1006..4f3bcc59a6385e7cdae9e47039fe877f1f855d1c 100644 (file)
@@ -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;