diff options
Diffstat (limited to 'kernel/kexec.c')
-rw-r--r-- | kernel/kexec.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index bf39d28e4c0e..50087ecf337e 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -902,14 +902,14 @@ static int kimage_load_segment(struct kimage *image, | |||
902 | * kexec does not sync, or unmount filesystems so if you need | 902 | * kexec does not sync, or unmount filesystems so if you need |
903 | * that to happen you need to do that yourself. | 903 | * that to happen you need to do that yourself. |
904 | */ | 904 | */ |
905 | struct kimage *kexec_image = NULL; | 905 | struct kimage *kexec_image; |
906 | static struct kimage *kexec_crash_image = NULL; | 906 | struct kimage *kexec_crash_image; |
907 | /* | 907 | /* |
908 | * A home grown binary mutex. | 908 | * A home grown binary mutex. |
909 | * Nothing can wait so this mutex is safe to use | 909 | * Nothing can wait so this mutex is safe to use |
910 | * in interrupt context :) | 910 | * in interrupt context :) |
911 | */ | 911 | */ |
912 | static int kexec_lock = 0; | 912 | static int kexec_lock; |
913 | 913 | ||
914 | asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, | 914 | asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, |
915 | struct kexec_segment __user *segments, | 915 | struct kexec_segment __user *segments, |
@@ -1042,7 +1042,6 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, | |||
1042 | 1042 | ||
1043 | void crash_kexec(struct pt_regs *regs) | 1043 | void crash_kexec(struct pt_regs *regs) |
1044 | { | 1044 | { |
1045 | struct kimage *image; | ||
1046 | int locked; | 1045 | int locked; |
1047 | 1046 | ||
1048 | 1047 | ||
@@ -1056,12 +1055,11 @@ void crash_kexec(struct pt_regs *regs) | |||
1056 | */ | 1055 | */ |
1057 | locked = xchg(&kexec_lock, 1); | 1056 | locked = xchg(&kexec_lock, 1); |
1058 | if (!locked) { | 1057 | if (!locked) { |
1059 | image = xchg(&kexec_crash_image, NULL); | 1058 | if (kexec_crash_image) { |
1060 | if (image) { | ||
1061 | struct pt_regs fixed_regs; | 1059 | struct pt_regs fixed_regs; |
1062 | crash_setup_regs(&fixed_regs, regs); | 1060 | crash_setup_regs(&fixed_regs, regs); |
1063 | machine_crash_shutdown(&fixed_regs); | 1061 | machine_crash_shutdown(&fixed_regs); |
1064 | machine_kexec(image); | 1062 | machine_kexec(kexec_crash_image); |
1065 | } | 1063 | } |
1066 | xchg(&kexec_lock, 0); | 1064 | xchg(&kexec_lock, 0); |
1067 | } | 1065 | } |