Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbXBFLky (ORCPT ); Tue, 6 Feb 2007 06:40:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751695AbXBFLky (ORCPT ); Tue, 6 Feb 2007 06:40:54 -0500 Received: from ns2.suse.de ([195.135.220.15]:36779 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbXBFLkx (ORCPT ); Tue, 6 Feb 2007 06:40:53 -0500 Date: Tue, 6 Feb 2007 12:40:50 +0100 From: Bernhard Walle To: Andrew Morton Cc: linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, fastboot@lists.osdl.org Subject: [PATCH] Fix NULL-pointer dereference in ia64_machine_kexec() Message-ID: <20070206114050.GA3648@strauss.suse.de> Mail-Followup-To: Andrew Morton , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, fastboot@lists.osdl.org References: <20070127131514.GA30463@strauss.suse.de> <45BBD6F5.6040801@sgi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45BBD6F5.6040801@sgi.com> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2056 Lines: 61 [I got no response after my corrected patch, so I try it again. I request it to appear in -mm tree. Patch is against 2.6.20-rc6-mm3.] 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 --- 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(;;); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/