summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>2024-12-16 16:49:23 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-08 09:51:52 +0100
commitd01e6a67595068741373f71759d5ff5e30faa116 (patch)
tree7bc4c1aa3e5cf4d3e7faf29b6fe2fa04029af329 /drivers/leds
parent7fd7fd629a3314e84e051b7c26b6a6952ffc3299 (diff)
downloadlinux-d01e6a67595068741373f71759d5ff5e30faa116.tar.gz
linux-d01e6a67595068741373f71759d5ff5e30faa116.tar.bz2
linux-d01e6a67595068741373f71759d5ff5e30faa116.zip
leds: netxbig: Fix an OF node reference leak in netxbig_leds_get_of_pdata()
[ Upstream commit 0508316be63bb735f59bdc8fe4527cadb62210ca ] 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: 9af512e81964 ("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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-netxbig.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
index 77213b79f84d..6692de0af68f 100644
--- a/drivers/leds/leds-netxbig.c
+++ b/drivers/leds/leds-netxbig.c
@@ -440,6 +440,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
}
gpio_ext_pdev = of_find_device_by_node(gpio_ext_np);
if (!gpio_ext_pdev) {
+ of_node_put(gpio_ext_np);
dev_err(dev, "Failed to find platform device for gpio-ext\n");
return -ENODEV;
}