Skip to contentSkip to conversation

Fix crashdump panic with CONFIG_KEXEC_JUMP

BUGFIX Huang Ying 1 participant 2 messages May 8, 2009 x86

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

Tim Starling reported that crashdump will panic with kernel compiled with CONFIG_KEXEC_JUMP due to null pointer deference in machine_kexec_32.c: machine_kexec(), when deferencing kexec_image. Refering to:

http://bugzilla.kernel.org/show_bug.cgi?id=13265

This patch fixes the BUG via replacing global variable reference:
kexec_image in machine_kexec() with local variable reference: image, which is more appropriate, and will not be null.

Same BUG is in machine_kexec_64.c too, so fixed too in the same way.

---
 arch/x86/kernel/machine_kexec_32.c |    4 ++--
 arch/x86/kernel/machine_kexec_64.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/machine_kexec_32.c +2 -2
@@ -194,7 +194,7 @@ void machine_kexec(struct kimage *image)
 				       unsigned int preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		save_processor_state();
 #endif
 
@@ -253,7 +253,7 @@ void machine_kexec(struct kimage *image)
 					   image->preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		restore_processor_state();
 #endif
 
arch/x86/kernel/machine_kexec_64.c +2 -2
@@ -274,7 +274,7 @@ void machine_kexec(struct kimage *image)
 	int save_ftrace_enabled;
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		save_processor_state();
 #endif
 
@@ -333,7 +333,7 @@ void machine_kexec(struct kimage *image)
 				       image->preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		restore_processor_state();
 #endif
 
#1 lore raw

[tip:x86/urgent] x86, kexec: fix crashdump panic with CONFIG_KEXEC_JUMP

Commit-ID:  6407df5ca54a511054200a1eb23f78f723ca1de4
Gitweb:     http://git.kernel.org/tip/6407df5ca54a511054200a1eb23f78f723ca1de4
Author:     Huang Ying <[email protected]>
AuthorDate: Fri, 8 May 2009 10:51:41 +0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 7 May 2009 22:01:05 -0700

x86, kexec: fix crashdump panic with CONFIG_KEXEC_JUMP

Tim Starling reported that crashdump will panic with kernel compiled with CONFIG_KEXEC_JUMP due to null pointer deference in machine_kexec_32.c: machine_kexec(), when deferencing kexec_image. Refering to:

http://bugzilla.kernel.org/show_bug.cgi?id=13265

This patch fixes the BUG via replacing global variable reference:
kexec_image in machine_kexec() with local variable reference: image, which is more appropriate, and will not be null.

Same BUG is in machine_kexec_64.c too, so fixed too in the same way.

[ Impact: fix crash on kexec ]

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/machine_kexec_32.c |    4 ++--
 arch/x86/kernel/machine_kexec_64.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/machine_kexec_32.c +2 -2
index e7368c1..c1c429d 100644
@@ -194,7 +194,7 @@ void machine_kexec(struct kimage *image)
 				       unsigned int preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		save_processor_state();
 #endif
 
@@ -253,7 +253,7 @@ void machine_kexec(struct kimage *image)
 					   image->preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		restore_processor_state();
 #endif
 
arch/x86/kernel/machine_kexec_64.c +2 -2
index 89cea4d..84c3bf2 100644
@@ -274,7 +274,7 @@ void machine_kexec(struct kimage *image)
 	int save_ftrace_enabled;
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		save_processor_state();
 #endif
 
@@ -333,7 +333,7 @@ void machine_kexec(struct kimage *image)
 				       image->preserve_context);
 
 #ifdef CONFIG_KEXEC_JUMP
-	if (kexec_image->preserve_context)
+	if (image->preserve_context)
 		restore_processor_state();
 #endif