diff options
Diffstat (limited to 'kernel/kexec.c')
| -rw-r--r-- | kernel/kexec.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index 58f0f382597c..fcdd5d2bc3f4 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -40,7 +40,7 @@ struct resource crashk_res = { | |||
| 40 | 40 | ||
| 41 | int kexec_should_crash(struct task_struct *p) | 41 | int kexec_should_crash(struct task_struct *p) |
| 42 | { | 42 | { |
| 43 | if (in_interrupt() || !p->pid || p->pid == 1 || panic_on_oops) | 43 | if (in_interrupt() || !p->pid || is_init(p) || panic_on_oops) |
| 44 | return 1; | 44 | return 1; |
| 45 | return 0; | 45 | return 0; |
| 46 | } | 46 | } |
| @@ -995,7 +995,8 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, | |||
| 995 | image = xchg(dest_image, image); | 995 | image = xchg(dest_image, image); |
| 996 | 996 | ||
| 997 | out: | 997 | out: |
| 998 | xchg(&kexec_lock, 0); /* Release the mutex */ | 998 | locked = xchg(&kexec_lock, 0); /* Release the mutex */ |
| 999 | BUG_ON(!locked); | ||
| 999 | kimage_free(image); | 1000 | kimage_free(image); |
| 1000 | 1001 | ||
| 1001 | return result; | 1002 | return result; |
| @@ -1042,7 +1043,6 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, | |||
| 1042 | 1043 | ||
| 1043 | void crash_kexec(struct pt_regs *regs) | 1044 | void crash_kexec(struct pt_regs *regs) |
| 1044 | { | 1045 | { |
| 1045 | struct kimage *image; | ||
| 1046 | int locked; | 1046 | int locked; |
| 1047 | 1047 | ||
| 1048 | 1048 | ||
| @@ -1056,14 +1056,14 @@ void crash_kexec(struct pt_regs *regs) | |||
| 1056 | */ | 1056 | */ |
| 1057 | locked = xchg(&kexec_lock, 1); | 1057 | locked = xchg(&kexec_lock, 1); |
| 1058 | if (!locked) { | 1058 | if (!locked) { |
| 1059 | image = xchg(&kexec_crash_image, NULL); | 1059 | if (kexec_crash_image) { |
| 1060 | if (image) { | ||
| 1061 | struct pt_regs fixed_regs; | 1060 | struct pt_regs fixed_regs; |
| 1062 | crash_setup_regs(&fixed_regs, regs); | 1061 | crash_setup_regs(&fixed_regs, regs); |
| 1063 | machine_crash_shutdown(&fixed_regs); | 1062 | machine_crash_shutdown(&fixed_regs); |
| 1064 | machine_kexec(image); | 1063 | machine_kexec(kexec_crash_image); |
| 1065 | } | 1064 | } |
| 1066 | xchg(&kexec_lock, 0); | 1065 | locked = xchg(&kexec_lock, 0); |
| 1066 | BUG_ON(!locked); | ||
| 1067 | } | 1067 | } |
| 1068 | } | 1068 | } |
| 1069 | 1069 | ||
