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-next>] [day] [month] [year] [list]
Date:	Thu, 30 Oct 2014 14:18:33 -0700
From:	Florian Fainelli <f.fainelli@...il.com>
To:	linux-serial@...r.kernel.ogr
Cc:	linux-kernel@...r.kernel.org, jslaby@...e.cz,
	gregkh@...uxfoundation.org, devicetree@...r.kernel.org,
	jingchang.lu@...escale.com, arnd@...db.de, gregory.0xf0@...il.com,
	Florian Fainelli <f.fainelli@...il.com>
Subject: [PATCH] serial: of-serial: zero-out struct of_serial_info

of_platform_serial_probe() invokes of_platform_serial_setup() with a
kmalloc'd struct of_serial_info cookie, which is not much of a problem
for most of the struct of_serial_info fields we access but info->clk.

On platforms which do not provide a clock phandle for their UART nodes
but do provide a 'clock-frequency' property, we basically leave the
info->clk variable uninitialized, and this craps out during
suspend/resume with oopses, crashes or warnings in the clock code.

Fix this by using kzalloc() which also zeroes-out the structure and
provides an initialized info->clk member set to NULL.

Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
Greg, Jiri,

This fixes a regression introduced in 3.18-rc1, thanks!

 drivers/tty/serial/of_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563335ae..56982da4a9e9 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 	if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
 		return -EBUSY;
 
-	info = kmalloc(sizeof(*info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (info == NULL)
 		return -ENOMEM;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ