Skip to content

Commit

Permalink
x86, kexec: fix crashdump panic with CONFIG_KEXEC_JUMP
Browse files Browse the repository at this point in the history
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 ]

Reported-by: Tim Starling <tstarling@wikimedia.org>
Signed-off-by: Huang Ying <ying.huang@intel.com>
LKML-Reference: <1241751101.6259.85.camel@yhuang-dev.sh.intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Huang Ying authored and H. Peter Anvin committed May 8, 2009
1 parent 4983439 commit 6407df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/machine_kexec_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/machine_kexec_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6407df5

Please sign in to comment.