Message ID | 20250108011537.2748127-1-joe@pf.is.s.u-tokyo.ac.jp (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fbdev: omapfb: Fix an OF node leak in dss_of_port_get_parent_device() | expand |
Hi Joe, Thank you for the patch. On Wed, Jan 08, 2025 at 10:15:37AM +0900, Joe Hattori wrote: > 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> > --- > drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c > index c04cbe0ef173..7c636db79882 100644 > --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c > +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c > @@ -36,6 +36,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; > } >
You missed to CC fbdev mailing list. On 1/9/25 00:03, Laurent Pinchart wrote: > On Wed, Jan 08, 2025 at 10:15:37AM +0900, Joe Hattori wrote: >> 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> > >> --- >> drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + >> 1 file changed, 1 insertion(+) Applied to fbdev git tree. Please speak up if you want to take it through another tree. Helge
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c index c04cbe0ef173..7c636db79882 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c @@ -36,6 +36,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; }
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> --- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + 1 file changed, 1 insertion(+)