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:   Tue, 30 Nov 2021 16:34:11 +0800
From:   Zhou Qingyang <zhou1615@....edu>
To:     zhou1615@....edu
Cc:     kjlu@....edu, Russell King <linux@...linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ARM: sa1100: Fix a wild pointer dereference in sa11xx_clk_init()

In sa11xx_clk_init(), the return value of clk_hw_register_mux() is
assigned to hw, and there is a dereference of it in sa11xx_clk_init().
clk_hw_register_mux() is a wrapper of __clk_hw_register_mux(), which
could return a ERR_PTR on error, and lead to a wild pointer dereference.

Fix this bug by adding a return value check.

This bug was found by a static analyzer. The analysis employs
differential checking to identify inconsistent security operations
(e.g., checks or kfrees) between two code paths and confirms that the
inconsistent operations are not recovered in the current function or
the callers, so they constitute bugs.

Note that, as a bug found by static analysis, it can be a false
positive or hard to trigger. Multiple researchers have cross-reviewed
the bug.

Since I do not have a sa1100 machine, I can not actually evaluate this
patch.

Fixes: d6c8204659eb ("ARM: sa1100: convert to common clock framework")
Signed-off-by: Zhou Qingyang <zhou1615@....edu>
---
 arch/arm/mach-sa1100/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index e8691921c69a..5b4d8e556ad2 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -127,6 +127,9 @@ int __init sa11xx_clk_init(void)
 				 ARRAY_SIZE(clk_tucr_parents), 0,
 				 (void __iomem *)&TUCR, FShft(TUCR_TSEL),
 				 FAlnMsk(TUCR_TSEL), 0, &tucr_lock);
+	if (IS_ERR(hw))
+		return PTR_ERR(hw);
+
 	clk_set_rate(hw->clk, 3686400);
 
 	hw = kzalloc(sizeof(*hw), GFP_KERNEL);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ