[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-9a8709d44139748fe2e0ab56d20d8c384c8b65ad@git.kernel.org>
Date: Mon, 4 May 2009 16:58:18 GMT
From: tip-bot for Cyrill Gorcunov <gorcunov@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
gorcunov@...nvz.org, steiner@....com, tglx@...utronix.de,
gorcunov@...il.com, mingo@...e.hu
Subject: [tip:x86/apic] x86: uv - prevent NULL dereference in uv_system_init()
Commit-ID: 9a8709d44139748fe2e0ab56d20d8c384c8b65ad
Gitweb: http://git.kernel.org/tip/9a8709d44139748fe2e0ab56d20d8c384c8b65ad
Author: Cyrill Gorcunov <gorcunov@...il.com>
AuthorDate: Sat, 2 May 2009 00:25:11 +0400
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Sun, 3 May 2009 10:49:31 +0200
x86: uv - prevent NULL dereference in uv_system_init()
We may reach NULL dereference oops if kmalloc failed.
Prevent it with explicit BUG_ON.
[ Impact: more controlled assert in 'impossible' scenario ]
Signed-off-by: Cyrill Gorcunov <gorcunov@...nvz.org>
Acked-by: Jack Steiner <steiner@....com>
LKML-Reference: <20090501202511.GE4633@...ovo>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
arch/x86/kernel/apic/x2apic_uv_x.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 873bf71..9d9e228 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -569,15 +569,18 @@ void __init uv_system_init(void)
bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
uv_blade_info = kmalloc(bytes, GFP_KERNEL);
+ BUG_ON(!uv_blade_info);
get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes();
uv_node_to_blade = kmalloc(bytes, GFP_KERNEL);
+ BUG_ON(!uv_node_to_blade);
memset(uv_node_to_blade, 255, bytes);
bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus();
uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL);
+ BUG_ON(!uv_cpu_to_blade);
memset(uv_cpu_to_blade, 255, bytes);
blade = 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