]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/arm-exynos-fix-a-leaked-reference-by-adding-missing-of_node_put.patch
c5a0a5e67d21cf5ce062a70a4834f40deecdda80
[thirdparty/kernel/stable-queue.git] / queue-4.4 / arm-exynos-fix-a-leaked-reference-by-adding-missing-of_node_put.patch
1 From 629266bf7229cd6a550075f5961f95607b823b59 Mon Sep 17 00:00:00 2001
2 From: Wen Yang <wen.yang99@zte.com.cn>
3 Date: Tue, 5 Mar 2019 19:33:54 +0800
4 Subject: ARM: exynos: Fix a leaked reference by adding missing of_node_put
5
6 From: Wen Yang <wen.yang99@zte.com.cn>
7
8 commit 629266bf7229cd6a550075f5961f95607b823b59 upstream.
9
10 The call to of_get_next_child returns a node pointer with refcount
11 incremented thus it must be explicitly decremented after the last
12 usage.
13
14 Detected by coccinelle with warnings like:
15 arch/arm/mach-exynos/firmware.c:201:2-8: ERROR: missing of_node_put;
16 acquired a node pointer with refcount incremented on line 193,
17 but without a corresponding object release within this function.
18
19 Cc: stable@vger.kernel.org
20 Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
21 Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 arch/arm/mach-exynos/firmware.c | 1 +
26 arch/arm/mach-exynos/suspend.c | 2 ++
27 2 files changed, 3 insertions(+)
28
29 --- a/arch/arm/mach-exynos/firmware.c
30 +++ b/arch/arm/mach-exynos/firmware.c
31 @@ -207,6 +207,7 @@ void __init exynos_firmware_init(void)
32 return;
33
34 addr = of_get_address(nd, 0, NULL, NULL);
35 + of_node_put(nd);
36 if (!addr) {
37 pr_err("%s: No address specified.\n", __func__);
38 return;
39 --- a/arch/arm/mach-exynos/suspend.c
40 +++ b/arch/arm/mach-exynos/suspend.c
41 @@ -725,8 +725,10 @@ void __init exynos_pm_init(void)
42
43 if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) {
44 pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
45 + of_node_put(np);
46 return;
47 }
48 + of_node_put(np);
49
50 pm_data = (const struct exynos_pm_data *) match->data;
51