diff options
author | Huang Ying <ying.huang@intel.com> | 2009-05-07 22:51:41 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-08 01:01:05 -0400 |
commit | 6407df5ca54a511054200a1eb23f78f723ca1de4 (patch) | |
tree | e27f6355b899deae894d8c80ab0906f546654534 | |
parent | 498343967613183611ac37dccb2846496d954c06 (diff) |
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 ]
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>
-rw-r--r-- | arch/x86/kernel/machine_kexec_32.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/machine_kexec_64.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index e7368c1da01d..c1c429d00130 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c | |||
@@ -194,7 +194,7 @@ void machine_kexec(struct kimage *image) | |||
194 | unsigned int preserve_context); | 194 | unsigned int preserve_context); |
195 | 195 | ||
196 | #ifdef CONFIG_KEXEC_JUMP | 196 | #ifdef CONFIG_KEXEC_JUMP |
197 | if (kexec_image->preserve_context) | 197 | if (image->preserve_context) |
198 | save_processor_state(); | 198 | save_processor_state(); |
199 | #endif | 199 | #endif |
200 | 200 | ||
@@ -253,7 +253,7 @@ void machine_kexec(struct kimage *image) | |||
253 | image->preserve_context); | 253 | image->preserve_context); |
254 | 254 | ||
255 | #ifdef CONFIG_KEXEC_JUMP | 255 | #ifdef CONFIG_KEXEC_JUMP |
256 | if (kexec_image->preserve_context) | 256 | if (image->preserve_context) |
257 | restore_processor_state(); | 257 | restore_processor_state(); |
258 | #endif | 258 | #endif |
259 | 259 | ||
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 89cea4d44679..84c3bf209e98 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c | |||
@@ -274,7 +274,7 @@ void machine_kexec(struct kimage *image) | |||
274 | int save_ftrace_enabled; | 274 | int save_ftrace_enabled; |
275 | 275 | ||
276 | #ifdef CONFIG_KEXEC_JUMP | 276 | #ifdef CONFIG_KEXEC_JUMP |
277 | if (kexec_image->preserve_context) | 277 | if (image->preserve_context) |
278 | save_processor_state(); | 278 | save_processor_state(); |
279 | #endif | 279 | #endif |
280 | 280 | ||
@@ -333,7 +333,7 @@ void machine_kexec(struct kimage *image) | |||
333 | image->preserve_context); | 333 | image->preserve_context); |
334 | 334 | ||
335 | #ifdef CONFIG_KEXEC_JUMP | 335 | #ifdef CONFIG_KEXEC_JUMP |
336 | if (kexec_image->preserve_context) | 336 | if (image->preserve_context) |
337 | restore_processor_state(); | 337 | restore_processor_state(); |
338 | #endif | 338 | #endif |
339 | 339 | ||