]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
ecd4a84e895027aad8d3d5bc34e3e86f7a2c986e
[thirdparty/kernel/stable-queue.git] /
1 From 8964eb23408243ae0016d1f8473c76f64ff25d20 Mon Sep 17 00:00:00 2001
2 From: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
3 Date: Mon, 4 Nov 2024 19:01:19 +0900
4 Subject: media: platform: exynos4-is: Fix an OF node reference leak in fimc_md_is_isp_available
5
6 From: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
7
8 commit 8964eb23408243ae0016d1f8473c76f64ff25d20 upstream.
9
10 In fimc_md_is_isp_available(), of_get_child_by_name() is called to check
11 if FIMC-IS is available. Current code does not decrement the refcount of
12 the returned device node, which causes an OF node reference leak. Fix it
13 by calling of_node_put() at the end of the variable scope.
14
15 Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
16 Fixes: e781bbe3fecf ("[media] exynos4-is: Add fimc-is subdevs registration")
17 Cc: stable@vger.kernel.org
18 Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
19 Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
20 [hverkuil: added CC to stable]
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 drivers/media/platform/samsung/exynos4-is/media-dev.h | 5 +++--
24 1 file changed, 3 insertions(+), 2 deletions(-)
25
26 --- a/drivers/media/platform/samsung/exynos4-is/media-dev.h
27 +++ b/drivers/media/platform/samsung/exynos4-is/media-dev.h
28 @@ -178,8 +178,9 @@ int fimc_md_set_camclk(struct v4l2_subde
29 #ifdef CONFIG_OF
30 static inline bool fimc_md_is_isp_available(struct device_node *node)
31 {
32 - node = of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME);
33 - return node ? of_device_is_available(node) : false;
34 + struct device_node *child __free(device_node) =
35 + of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME);
36 + return child ? of_device_is_available(child) : false;
37 }
38 #else
39 #define fimc_md_is_isp_available(node) (false)