]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/cpufreq-pmac32-fix-possible-object-reference-leak.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / cpufreq-pmac32-fix-possible-object-reference-leak.patch
1 From ad530bf74c75ae48b3acb699602c45cb65f31812 Mon Sep 17 00:00:00 2001
2 From: Wen Yang <wen.yang99@zte.com.cn>
3 Date: Mon, 1 Apr 2019 09:37:53 +0800
4 Subject: cpufreq: pmac32: fix possible object reference leak
5
6 [ Upstream commit 8d10dc28a9ea6e8c02e825dab28699f3c72b02d9 ]
7
8 The call to of_find_node_by_name returns a node pointer with refcount
9 incremented thus it must be explicitly decremented after the last
10 usage.
11
12 Detected by coccinelle with the following warnings:
13 ./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
14 ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
15 ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function.
16
17 Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
18 Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
19 Cc: Viresh Kumar <viresh.kumar@linaro.org>
20 Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
21 Cc: Paul Mackerras <paulus@samba.org>
22 Cc: Michael Ellerman <mpe@ellerman.id.au>
23 Cc: linux-pm@vger.kernel.org
24 Cc: linuxppc-dev@lists.ozlabs.org
25 Cc: linux-kernel@vger.kernel.org
26 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 drivers/cpufreq/pmac32-cpufreq.c | 2 ++
30 1 file changed, 2 insertions(+)
31
32 diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
33 index 1f49d97a70ea1..14928e0dc3265 100644
34 --- a/drivers/cpufreq/pmac32-cpufreq.c
35 +++ b/drivers/cpufreq/pmac32-cpufreq.c
36 @@ -549,6 +549,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
37 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
38 if (volt_gpio_np)
39 voltage_gpio = read_gpio(volt_gpio_np);
40 + of_node_put(volt_gpio_np);
41 if (!voltage_gpio){
42 printk(KERN_ERR "cpufreq: missing cpu-vcore-select gpio\n");
43 return 1;
44 @@ -585,6 +586,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
45 if (volt_gpio_np)
46 voltage_gpio = read_gpio(volt_gpio_np);
47
48 + of_node_put(volt_gpio_np);
49 pvr = mfspr(SPRN_PVR);
50 has_cpu_l2lve = !((pvr & 0xf00) == 0x100);
51
52 --
53 2.20.1
54