]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 78b07f7e18ccc1149ef3e29318c6c22cb304998d Mon Sep 17 00:00:00 2001 |
2 | From: Wen Yang <wen.yang99@zte.com.cn> | |
3 | Date: Mon, 1 Apr 2019 09:37:54 +0800 | |
4 | Subject: cpufreq: ppc_cbe: fix possible object reference leak | |
5 | ||
6 | [ Upstream commit 233298032803f2802fe99892d0de4ab653bfece4 ] | |
7 | ||
8 | The call to of_get_cpu_node 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/ppc_cbe_cpufreq.c:89:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 76, but without a corresponding object release within this function. | |
14 | ./drivers/cpufreq/ppc_cbe_cpufreq.c:89:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 76, but without a corresponding object release within this function. | |
15 | ||
16 | Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> | |
17 | Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> | |
18 | Cc: Viresh Kumar <viresh.kumar@linaro.org> | |
19 | Cc: linux-pm@vger.kernel.org | |
20 | Cc: linux-kernel@vger.kernel.org | |
21 | Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> | |
22 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
23 | --- | |
24 | drivers/cpufreq/ppc_cbe_cpufreq.c | 1 + | |
25 | 1 file changed, 1 insertion(+) | |
26 | ||
27 | diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c | |
28 | index 5a4c5a639f618..2eaeebcc93afe 100644 | |
29 | --- a/drivers/cpufreq/ppc_cbe_cpufreq.c | |
30 | +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c | |
31 | @@ -86,6 +86,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |
32 | if (!cbe_get_cpu_pmd_regs(policy->cpu) || | |
33 | !cbe_get_cpu_mic_tm_regs(policy->cpu)) { | |
34 | pr_info("invalid CBE regs pointers for cpufreq\n"); | |
35 | + of_node_put(cpu); | |
36 | return -EINVAL; | |
37 | } | |
38 | ||
39 | -- | |
40 | 2.20.1 | |
41 |