]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fbdev: omapfb: Fix an OF node leak in dss_of_port_get_parent_device()
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Wed, 8 Jan 2025 01:15:37 +0000 (10:15 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:07 +0000 (12:50 +0100)
[ Upstream commit de124b61e179e690277116e6be512e4f422b5dd8 ]

dss_of_port_get_parent_device() leaks an OF node reference when i >= 2
and struct device_node *np is present. Since of_get_next_parent()
obtains a reference of the returned OF node, call of_node_put() before
returning NULL.

This was found by an experimental verifier that I am developing, and no
runtime test was able to be performed due to that lack of actual
devices.

Fixes: f76ee892a99e ("omapfb: copy omapdss & displays for omapfb")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c

index 0282d4eef139d4971a86b2c2e5b0b289ac9c5a19..3b16c3342cb77e0040e83cd216295d52c26903d7 100644 (file)
@@ -102,6 +102,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port)
                np = of_get_next_parent(np);
        }
 
+       of_node_put(np);
        return NULL;
 }