public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH -tip/master] x86: io-apic - restore_IO_APIC_setup NULL pointer quick fix
Date: Thu, 18 Sep 2008 23:37:57 +0400	[thread overview]
Message-ID: <20080918193757.GB7294@lenovo> (raw)

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)

             reply	other threads:[~2008-09-18 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 19:37 Cyrill Gorcunov [this message]
2008-09-19  8:05 ` [PATCH -tip/master] x86: io-apic - restore_IO_APIC_setup NULL pointer quick fix Ingo Molnar
2008-09-19 10:00   ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080918193757.GB7294@lenovo \
    --to=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=yhlu.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox