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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1555139666-948-8-git-send-email-hofrat@osadl.org>
Date:   Sat, 13 Apr 2019 09:14:19 +0200
From:   Nicholas Mc Guire <hofrat@...dl.org>
To:     Russell King <linux@...linux.org.uk>
Cc:     Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Mark Brown <broonie@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Tony Lindgren <tony@...mide.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Janusz Krzysztofik <jmkrzyszt@...il.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH V2] ARM: STi: warn if scu mapping fails

 If the device node is not found or the of_iomap() failed, calling
scu_enable would not be safe and could lead to an undefined system
state. So warn in both failure paths before returning.

Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
Link: http://lkml.org/lkml/2018/7/16/219
Fixes: commit 65ebcc115889 ("ARM: sti: Add STiH415 SOC support")
---

V2: replacement of WARN_ON() by a meaningful pr_err as suggested by
    Patrice CHOTARD <patrice.chotard@...com>.

Problem was found by an experimental coccinelle script

Patch was compile tested with: multi_v7_defconfig (implies
CONFIG_ARCH_STI=y, CONFIG_SMP=y)
(with one sparse warning unrelated to the proposed change)

Patch is against 4.18-rc4 (localversion-next is next-20180716)

 arch/arm/mach-sti/platsmp.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index 231f19e..530e9a5 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -107,12 +107,22 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
 
 	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
 
-	if (np) {
-		scu_base = of_iomap(np, 0);
-		scu_enable(scu_base);
-		of_node_put(np);
+	if (!np) {
+		pr_err("SCU not found at %s:%s():%d\n",
+		       __FILE__, __func__, __LINE__);
+		return;
 	}
 
+	scu_base = of_iomap(np, 0);
+	of_node_put(np);
+	if (!scu_base) {
+		pr_err("SCU remap failed at %s:%s():%d\n",
+		       __FILE__, __func__, __LINE__);
+		return;
+	}
+
+	scu_enable(scu_base);
+
 	if (max_cpus <= 1)
 		return;
 
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ