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:   Sat, 18 Jun 2022 10:15:17 +0800
From:   Liang He <windhl@....com>
To:     andrew@...n.ch, gregory.clement@...tlin.com,
        sebastian.hesselbarth@...il.com, linux@...linux.org.uk
Cc:     windhl@....com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] arm: mach-mvebu: Fix refcount leak bug in pm.c

In mvebu_internal_reg_base(), of_find_node_by_name() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.

Signed-off-by: Liang He <windhl@....com>
---
 arch/arm/mach-mvebu/pm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
index c487be61d6d8..d00e43241dfa 100644
--- a/arch/arm/mach-mvebu/pm.c
+++ b/arch/arm/mach-mvebu/pm.c
@@ -91,6 +91,7 @@ static phys_addr_t mvebu_internal_reg_base(void)
 {
 	struct device_node *np;
 	__be32 in_addr[2];
+	phys_addr_t addr;
 
 	np = of_find_node_by_name(NULL, "internal-regs");
 	BUG_ON(!np);
@@ -103,7 +104,11 @@ static phys_addr_t mvebu_internal_reg_base(void)
 	in_addr[0] = cpu_to_be32(0xf0010000);
 	in_addr[1] = 0x0;
 
-	return of_translate_address(np, in_addr);
+	addr = of_translate_address(np, in_addr);
+
+	of_node_put(np);
+
+	return addr;
 }
 
 static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ