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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  8 Aug 2012 20:44:53 +0200
From:	Stephan Linz <linz@...pro.net>
To:	monstr@...str.eu
Cc:	microblaze-uclinux@...e.uq.edu.au, linux-kernel@...r.kernel.org,
	Stephan Linz <linz@...pro.net>
Subject: [PATCH] microblaze: uartlite: avoid NULL pointer exception

'prop' is an pointer and can only be unset (NULL) after
prop = of_get_property() when it goes wrong.

Kernel oops in ulite_probe():

[    1.016645] uartlite 8fff0000.debug: failed to get alias id, errno -19
[    1.024246] Oops: kernel access of bad area, sig: 11
[    1.029733]  Registers dump: mode=27827D60
[    1.034362]  r1=C79113E0, r2=00000000, r3=00000000, r4=00000000
[    1.040918]  r5=C02E1E49, r6=C02D5918, r7=00000070, r8=000014C9
[    1.047475]  r9=000014C8, r10=000014C9, r11=00000006, r12=FFFFFFFC
[    1.054318]  r13=00000000, r14=C79114A0, r15=C0293BDC, r16=00000000
[    1.061261]  r17=C0293BE4, r18=FFFFFFFE, r19=C788BDC8, r20=00000000
[    1.068207]  r21=00000000, r22=FFFFFFED, r23=C788BDC0, r24=C033E840
[    1.075145]  r25=C033EEA4, r26=00000000, r27=00000000, r28=00000000
[    1.082086]  r29=00000000, r30=00000000, r31=C7824AC0, rPC=C0293BE4
[    1.089024]  msr=000046A2, ear=00000000, esr=00000872, fsr=C7827E08
[    1.096281] Kernel panic - not syncing: Attempted to kill init!

Now it is:

[    1.014924] uartlite 8fff0000.debug: failed to get alias id, errno -19
[    1.022543] uartlite 8fff0000.debug: failed to get port-number

Signed-off-by: Stephan Linz <linz@...pro.net>
---
 drivers/tty/serial/uartlite.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index a276282..3cba732 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -589,9 +589,8 @@ static int __devinit ulite_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "failed to get alias id, errno %d\n", id);
 		/* Fall back to old port-number property */
 		prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
-		if (prop < 0) {
-			dev_warn(&pdev->dev,
-				"failed to get port-number, errno %d\n", prop);
+		if (!prop) {
+			dev_warn(&pdev->dev, "failed to get port-number\n");
 			id = -1;
 		} else
 			id = be32_to_cpup(prop);
-- 
1.7.0.4

--
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