From: Bernhard Walle <bwalle@suse.de>
To: linux-ia64@vger.kernel.org
Subject: [PATCH] Fix NULL-pointer dereference in ia64_machine_kexec()
Date: Sun, 28 Jan 2007 12:47:02 +0000 [thread overview]
Message-ID: <20070128124702.GA32567@strauss.suse.de> (raw)
In-Reply-To: <eparjg$nhq$1@sea.gmane.org>
[After changing the message, 2nd try:]
This patch fixes a NULL-pointer dereference in ia64_machine_kexec().
The variable ia64_kimage is set in machine_kexec_prepare() which is
called from sys_kexec_load(). If kdump wasn't configured before,
ia64_kimage is NULL. machine_kdump_on_init() passes ia64_kimage() to
machine_kexec() which assumes a valid value.
The patch also adds a few sanity checks for the image to simplify
debugging of similar problems in future.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
arch/ia64/kernel/crash.c | 5 +++++
arch/ia64/kernel/machine_kexec.c | 2 ++
2 files changed, 7 insertions(+)
Index: b/arch/ia64/kernel/crash.c
=================================--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -116,6 +116,11 @@ machine_crash_shutdown(struct pt_regs *p
static void
machine_kdump_on_init(void)
{
+ if (!ia64_kimage) {
+ printk(KERN_NOTICE "machine_kdump_on_init(): "
+ "kdump not configured\n");
+ return;
+ }
local_irq_disable();
kexec_disable_iosapic();
machine_kexec(ia64_kimage);
Index: b/arch/ia64/kernel/machine_kexec.c
=================================--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -93,6 +93,7 @@ static void ia64_machine_kexec(struct un
unsigned long vector;
int ii;
+ BUG_ON(!image);
if (image->type = KEXEC_TYPE_CRASH) {
crash_save_this_cpu();
current->thread.ksp = (__u64)info->sw - 16;
@@ -131,6 +132,7 @@ static void ia64_machine_kexec(struct un
void machine_kexec(struct kimage *image)
{
+ BUG_ON(!image);
unw_init_running(ia64_machine_kexec, image);
for(;;);
}
prev parent reply other threads:[~2007-01-28 12:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-25 18:06 [PATCH] Fix NULL-pointer dereference in ia64_machine_kexec() Bernhard Walle
2007-01-27 6:28 ` Jes Sorensen
2007-01-27 13:15 ` Bernhard Walle
2007-01-27 22:49 ` Jes Sorensen
2007-02-06 11:40 ` Bernhard Walle
2007-02-06 11:40 ` Bernhard Walle
2007-01-28 12:47 ` Bernhard Walle [this message]
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=20070128124702.GA32567@strauss.suse.de \
--to=bwalle@suse.de \
--cc=linux-ia64@vger.kernel.org \
/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 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.