All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] x86: uv - prevent NULL dereference in uv_system_init
@ 2009-05-01 19:56 Cyrill Gorcunov
  2009-05-01 20:03 ` Ingo Molnar
  0 siblings, 1 reply; 33+ messages in thread
From: Cyrill Gorcunov @ 2009-05-01 19:56 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: H. Peter Anvin, Thomas Gleixner, LKML, Jack Steiner

We may reach NULL dereference oops if kmalloc failed.
Lets do panic better with sensible message.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---

Actually there is a dubious place as well at early_get_nodeid.
Is there a guarantee that we _never_ fail in early_ioremap?

 arch/x86/kernel/apic/x2apic_uv_x.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux-2.6.git/arch/x86/kernel/apic/x2apic_uv_x.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/x2apic_uv_x.c
+++ linux-2.6.git/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -584,15 +584,21 @@ void __init uv_system_init(void)
 
 	bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
 	uv_blade_info = kmalloc(bytes, GFP_KERNEL);
+	if (!uv_blade_info)
+		goto err_nomem;
 
 	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);
+	if (!uv_node_to_blade)
+		goto err_nomem;
 	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);
+	if (!uv_cpu_to_blade)
+		goto err_nomem;
 	memset(uv_cpu_to_blade, 255, bytes);
 
 	blade = 0;
@@ -667,4 +673,7 @@ void __init uv_system_init(void)
 	uv_cpu_init();
 	uv_scir_register_cpu_notifier();
 	proc_mkdir("sgi_uv", NULL);
+
+err_nomem:
+	panic("UV: Out of memory\n");
 }

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2009-05-04 16:59 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-01 19:56 [PATCH -tip] x86: uv - prevent NULL dereference in uv_system_init Cyrill Gorcunov
2009-05-01 20:03 ` Ingo Molnar
2009-05-01 20:09   ` Cyrill Gorcunov
2009-05-01 20:25     ` Cyrill Gorcunov
2009-05-01 20:31       ` Jack Steiner
2009-05-03  8:48         ` Ingo Molnar
2009-05-03  9:01           ` Cyrill Gorcunov
2009-05-03  9:09           ` David Rientjes
2009-05-03  9:38             ` Cyrill Gorcunov
2009-05-03  9:53               ` David Rientjes
2009-05-03  9:59             ` Pekka Enberg
2009-05-03 12:12               ` Cyrill Gorcunov
2009-05-03 12:27                 ` Pekka Enberg
2009-05-03 14:38                   ` Cyrill Gorcunov
2009-05-03 16:54                     ` Pekka Enberg
2009-05-03 17:23                       ` introducing __GFP_PANIC Cyrill Gorcunov
2009-05-03 17:38                         ` Pekka Enberg
2009-05-03 17:49                           ` Cyrill Gorcunov
2009-05-03 20:45                           ` Cyrill Gorcunov
2009-05-03 20:58                             ` David Rientjes
2009-05-04  8:14                               ` Cyrill Gorcunov
2009-05-04  8:32                                 ` Pekka Enberg
2009-05-04  8:49                                   ` Cyrill Gorcunov
2009-05-04  9:56                                     ` Pekka Enberg
2009-05-04  9:08                                   ` Cyrill Gorcunov
2009-05-04  9:57                                     ` Pekka Enberg
2009-05-04 10:01                                       ` Cyrill Gorcunov
2009-05-04 10:11                                         ` Cyrill Gorcunov
2009-05-04 10:33                                           ` Pekka Enberg
2009-05-04 10:52                                             ` Cyrill Gorcunov
2009-05-04 10:56                                           ` David Rientjes
2009-05-04 11:10                                             ` Cyrill Gorcunov
2009-05-04 16:58       ` [tip:x86/apic] x86: uv - prevent NULL dereference in uv_system_init() tip-bot for Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.