* [PATCH] arm/kernel: Fix refcount leak bugs
@ 2022-06-19 6:59 Liang He
2022-06-22 8:53 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-19 6:59 UTC (permalink / raw)
To: linux, rmk+kernel, ardb, linus.walleij, arnd, rostedt, ebiederm
Cc: windhl, linux-arm-kernel, linux-kernel
In arm_dt_init_cpu_maps() and init_machine_late(), we need of_node_put()
to keep refcount balance.
Signed-off-by: Liang He <windhl@126.com>
---
arch/arm/kernel/devtree.c | 4 ++++
arch/arm/kernel/setup.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 02839d8b6202..d4dbc9eb382d 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -94,6 +94,7 @@ void __init arm_dt_init_cpu_maps(void)
*/
if (hwid & ~MPIDR_HWID_BITMASK) {
of_node_put(cpu);
+ of_node_put(cpus);
return;
}
@@ -108,6 +109,7 @@ void __init arm_dt_init_cpu_maps(void)
if (WARN(tmp_map[j] == hwid,
"Duplicate /cpu reg properties in the DT\n")) {
of_node_put(cpu);
+ of_node_put(cpus);
return;
}
@@ -148,6 +150,8 @@ void __init arm_dt_init_cpu_maps(void)
if (!found_method)
set_smp_ops_by_method(cpus);
+ of_node_put(cpus);
+
if (!bootcpu_valid) {
pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
return;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1e8a50a97edf..43ec8d78c219 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -960,6 +960,7 @@ static int __init init_machine_late(void)
if (root) {
ret = of_property_read_string(root, "serial-number",
&system_serial);
+ of_node_put(root);
if (ret)
system_serial = NULL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] arm/kernel: Fix refcount leak bugs
2022-06-19 6:59 [PATCH] arm/kernel: Fix refcount leak bugs Liang He
@ 2022-06-22 8:53 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-22 8:53 UTC (permalink / raw)
To: Liang He, linux, rmk+kernel, ardb, linus.walleij, arnd, rostedt,
ebiederm
Cc: linux-arm-kernel, linux-kernel
On 19/06/2022 08:59, Liang He wrote:
> In arm_dt_init_cpu_maps() and init_machine_late(), we need of_node_put()
> to keep refcount balance.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
Before applying the patch please check it carefully. Previous evidence
[1] suggests that not it was not even compiled.
[1] https://lore.kernel.org/all/202206221602.odN70SHs-lkp@intel.com/
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-22 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19 6:59 [PATCH] arm/kernel: Fix refcount leak bugs Liang He
2022-06-22 8:53 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®