]>
Commit | Line | Data |
---|---|---|
2f47b8fc SL |
1 | From 637c867ed223e089a652dacb3ee959a925c70c55 Mon Sep 17 00:00:00 2001 |
2 | From: Wen Yang <wen.yang99@zte.com.cn> | |
3 | Date: Tue, 5 Mar 2019 19:34:05 +0800 | |
4 | Subject: arm64: cpu_ops: fix a leaked reference by adding missing of_node_put | |
5 | ||
6 | [ Upstream commit 92606ec9285fb84cd9b5943df23f07d741384bfc ] | |
7 | ||
8 | The call to of_get_next_child 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 | ./arch/arm64/kernel/cpu_ops.c:102:1-7: ERROR: missing of_node_put; | |
14 | acquired a node pointer with refcount incremented on line 69, but | |
15 | without a corresponding object release within this function. | |
16 | ||
17 | Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> | |
18 | Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> | |
19 | Cc: Catalin Marinas <catalin.marinas@arm.com> | |
20 | Cc: Will Deacon <will.deacon@arm.com> | |
21 | Cc: linux-arm-kernel@lists.infradead.org | |
22 | Cc: linux-kernel@vger.kernel.org | |
23 | Signed-off-by: Will Deacon <will.deacon@arm.com> | |
24 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
25 | --- | |
26 | arch/arm64/kernel/cpu_ops.c | 1 + | |
27 | 1 file changed, 1 insertion(+) | |
28 | ||
29 | diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c | |
30 | index e137ceaf5016b..82b465207ed0a 100644 | |
31 | --- a/arch/arm64/kernel/cpu_ops.c | |
32 | +++ b/arch/arm64/kernel/cpu_ops.c | |
33 | @@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu) | |
34 | pr_err("%s: missing enable-method property\n", | |
35 | dn->full_name); | |
36 | } | |
37 | + of_node_put(dn); | |
38 | } else { | |
39 | enable_method = acpi_get_enable_method(cpu); | |
40 | if (!enable_method) { | |
41 | -- | |
42 | 2.20.1 | |
43 |