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]
Message-Id: <20061206233054.a69ceab3.amit2030@gmail.com>
Date:	Wed, 6 Dec 2006 23:30:54 -0800
From:	Amit Choudhary <amit2030@...il.com>
To:	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH 2.6.19] drivers/char/vt.c: check kmalloc() return value.

Description: Check the return value of kmalloc() in function con_init(), in file drivers/char/vt.c.

Signed-off-by: Amit Choudhary <amit2030@...il.com>

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 87587b4..6aa08cb 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2640,6 +2640,15 @@ static int __init con_init(void)
 	 */
 	for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
 		vc_cons[currcons].d = vc = alloc_bootmem(sizeof(struct vc_data));
+		if (!vc_cons[currcons].d) {
+			for (--currcons; currcons >= 0; currcons--) {
+				kfree(vc_cons[currcons].d);
+				vc_cons[currcons].d = NULL;
+			}
+			release_console_sem();
+			return -ENOMEM;
+		}
+
 		visual_init(vc, currcons, 1);
 		vc->vc_screenbuf = (unsigned short *)alloc_bootmem(vc->vc_screenbuf_size);
 		vc->vc_kmalloced = 0;
-
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