public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip/master] x86: io-apic - restore_IO_APIC_setup NULL pointer quick fix
@ 2008-09-18 19:37 Cyrill Gorcunov
  2008-09-19  8:05 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2008-09-18 19:37 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Maciej W. Rozycki, Yinghai Lu, LKML

Check if memory was granted first - we don't like NULL deref.
It's a *quick* fix. Actually it's better to hadle this error
at moment of memory allocation. It's save_mask_IO_APIC_setup
route who allocates this memory (just for the record).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

I'll handle this in _normal_ way tomorrow. Please review.

Index: linux-2.6.git/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/io_apic.c	2008-09-18 19:17:16.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/io_apic.c	2008-09-18 23:34:40.000000000 +0400
@@ -852,10 +852,14 @@ void restore_IO_APIC_setup(void)
 {
 	int apic, pin;
 
-	for (apic = 0; apic < nr_ioapics; apic++)
+	for (apic = 0; apic < nr_ioapics; apic++) {
+		/* FIXME: it should be handled at allocation time --cvg */
+		if (!early_ioapic_entries[apic])
+			break;
 		for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
 			ioapic_write_entry(apic, pin,
 					   early_ioapic_entries[apic][pin]);
+	}
 }
 
 void reinit_intr_remapped_IO_APIC(int intr_remapping)

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

end of thread, other threads:[~2008-09-19 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 19:37 [PATCH -tip/master] x86: io-apic - restore_IO_APIC_setup NULL pointer quick fix Cyrill Gorcunov
2008-09-19  8:05 ` Ingo Molnar
2008-09-19 10:00   ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox