Skip to content

Commit 901d169

Browse files
joehattorimehmetb0
authored andcommitted
leds: netxbig: Fix an OF node reference leak in netxbig_leds_get_of_pdata()
BugLink: https://bugs.launchpad.net/bugs/2111953 [ Upstream commit 0508316 ] netxbig_leds_get_of_pdata() does not release the OF node obtained by of_parse_phandle() when of_find_device_by_node() fails. Add an of_node_put() call to fix the leak. This bug was found by an experimental static analysis tool that I am developing. Fixes: 9af512e ("leds: netxbig: Convert to use GPIO descriptors") Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> Link: https://lore.kernel.org/r/20241216074923.628509-1-joe@pf.is.s.u-tokyo.ac.jp Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
1 parent 230028b commit 901d169

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/leds/leds-netxbig.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
440440
}
441441
gpio_ext_pdev = of_find_device_by_node(gpio_ext_np);
442442
if (!gpio_ext_pdev) {
443+
of_node_put(gpio_ext_np);
443444
dev_err(dev, "Failed to find platform device for gpio-ext\n");
444445
return -ENODEV;
445446
}

0 commit comments

Comments
 (0)