ARM: vexpress: fix iounmap missing after of_iomap in SMP prepare
Subsystems (4)
Sudeep Holla
maintainerPATCH 1/1 ARM: vexpress: fix iounmap missing after of_iomap in SMP prepare
of_iomap() maps a region of device memory and returns a pointer that must later be released with iounmap(). Currently return value from of_iomap() is passed directly to scu_enable() without saving it, making it impossible to unmap afterwards, causing an I/O memory leak.
Store the mapped base address in a local variable, check it for NULL, call scu_enable(), then release the mapping with iounmap().
--- arch/arm/mach-versatile/platsmp-vexpress.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-versatile/platsmp-vexpress.c +8 -2
@@ -63,9 +63,15 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus) { struct device_node *scu __free(device_node) =of_find_matching_node (NULL , vexpress_smp_dt_scu_match); +void __iomem *scu_base; -if (scu) -scu_enable (of_iomap (scu,0 )); +if (scu) { + scu_base =of_iomap (scu,0 ); +if (scu_base) { +scu_enable (scu_base); +iounmap (scu_base); + } + }/* * Write the address of secondary startup into the
Signature · 1 line
2.43.0
Quoted 5 lines · Sudeep Holla
of_iomap()maps a region of device memory and returns a pointer that must later be released withiounmap(). Currently return value fromof_iomap()is passed directly toscu_enable()without saving it, making it impossible to unmap afterwards, causing an I/O memory leak.
Quoted 7 lines
Store the mapped base address in a local variable, check it for NULL, call
scu_enable(), then release the mapping withiounmap().
Yours,
Linus Walleij
Quoted 9 lines · Sudeep Holla
of_iomap()maps a region of device memory and returns a pointer that must later be released withiounmap(). Currently return value fromof_iomap()is passed directly toscu_enable()without saving it, making it impossible to unmap afterwards, causing an I/O memory leak.Store the mapped base address in a local variable, check it for NULL, call
scu_enable(), then release the mapping withiounmap().[...]
Applied to sudeep.holla/linux (for-next/vexpress/updates), thanks!
[1/1] ARM: vexpress: fix iounmap missing after of_iomap in SMP prepare
https://git.kernel.org/sudeep.holla/c/3ce981979606
Signature · 2 lines
Regards, Sudeep