]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/cpuidle-big.little-fix-refcount-leak.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / cpuidle-big.little-fix-refcount-leak.patch
1 From da3173d3058200129d97a32efdd40ae33eb8d9a8 Mon Sep 17 00:00:00 2001
2 From: Yangtao Li <tiny.windzz@gmail.com>
3 Date: Mon, 10 Dec 2018 11:26:41 -0500
4 Subject: cpuidle: big.LITTLE: fix refcount leak
5
6 [ Upstream commit 9456823c842f346c74265fcd98d008d87a7eb6f5 ]
7
8 of_find_node_by_path() acquires a reference to the node
9 returned by it and that reference needs to be dropped by its caller.
10 bl_idle_init() doesn't do that, so fix it.
11
12 Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
13 Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
14 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
15 Signed-off-by: Sasha Levin <sashal@kernel.org>
16 ---
17 drivers/cpuidle/cpuidle-big_little.c | 7 ++++++-
18 1 file changed, 6 insertions(+), 1 deletion(-)
19
20 diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
21 index db2ede565f1a..b44476a1b7ad 100644
22 --- a/drivers/cpuidle/cpuidle-big_little.c
23 +++ b/drivers/cpuidle/cpuidle-big_little.c
24 @@ -167,6 +167,7 @@ static int __init bl_idle_init(void)
25 {
26 int ret;
27 struct device_node *root = of_find_node_by_path("/");
28 + const struct of_device_id *match_id;
29
30 if (!root)
31 return -ENODEV;
32 @@ -174,7 +175,11 @@ static int __init bl_idle_init(void)
33 /*
34 * Initialize the driver just for a compliant set of machines
35 */
36 - if (!of_match_node(compatible_machine_match, root))
37 + match_id = of_match_node(compatible_machine_match, root);
38 +
39 + of_node_put(root);
40 +
41 + if (!match_id)
42 return -ENODEV;
43
44 if (!mcpm_is_available())
45 --
46 2.19.1
47