lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 18 Dec 2022 15:10:29 +0100
From:   Martin Kaiser <martin@...ser.cx>
To:     Wei Xu <xuwei5@...ilicon.com>, Russell King <linux@...linux.org.uk>
Cc:     Martin Kaiser <martin@...ser.cx>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ARM: hisi: add missing of_node_put calls

A node that is returned by of_find_compatible_node has its refcount
incremented. We have to call of_node_put when the node is no longer
needed.

For hip04_smp_init, the easiest option is to call of_node_put for all
nodes at the end of the function. If we jump to the end of the function
because of an error, unused local np... pointers are NULL by default
and of_node_put(NULL) just returns.

Signed-off-by: Martin Kaiser <martin@...ser.cx>
---
compile-tested only, I don't have this hardware

 arch/arm/mach-hisi/platmcpm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
index 258586e31333..e4be6da07242 100644
--- a/arch/arm/mach-hisi/platmcpm.c
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -341,6 +341,9 @@ static int __init hip04_smp_init(void)
 err_reloc:
 	memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
 err:
+	of_node_put(np);
+	of_node_put(np_sctl);
+	of_node_put(np_fab);
 	return ret;
 }
 early_initcall(hip04_smp_init);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ