]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/arm-exynos-fix-a-leaked-reference-by-adding-missing-of_node_put.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / arm-exynos-fix-a-leaked-reference-by-adding-missing-of_node_put.patch
CommitLineData
09dfd60e
GKH
1From 629266bf7229cd6a550075f5961f95607b823b59 Mon Sep 17 00:00:00 2001
2From: Wen Yang <wen.yang99@zte.com.cn>
3Date: Tue, 5 Mar 2019 19:33:54 +0800
4Subject: ARM: exynos: Fix a leaked reference by adding missing of_node_put
5
6From: Wen Yang <wen.yang99@zte.com.cn>
7
8commit 629266bf7229cd6a550075f5961f95607b823b59 upstream.
9
10The call to of_get_next_child returns a node pointer with refcount
11incremented thus it must be explicitly decremented after the last
12usage.
13
14Detected 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
19Cc: stable@vger.kernel.org
20Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
21Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
22Signed-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