mtd: maps: Fix refcount leak in of_flash_probe_versatile
PATCH 1/1 mtd: maps: Fix refcount leak in of_flash_probe_versatile
of_find_matching_node_and_match() 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.
--- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap-versatile.c +1 -0
@@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, versatile_flashprot = (enum versatile_flashprot )devid->data; rmap =syscon_node_to_regmap (sysnp); +of_node_put (sysnp);if (IS_ERR (rmap))return PTR_ERR (rmap);
Signature · 1 line
2.25.1
Quoted 6 lines · Miaoqian Lin
of_find_matching_node_and_match()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore. Add missingof_node_put()to avoid refcount leak.Fixes b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection")Signed-off-by Miaoqian Lin <[email protected]>
Yours,
Linus Walleij
Quoted 7 lines · Miaoqian Lin
of_find_matching_node_and_match()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore. Add missingof_node_put()to avoid refcount leak.Fixes b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection")Signed-off-by Miaoqian Lin <[email protected]>Reviewed-by Linus Walleij <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/