|
@@ -274,8 +274,11 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
dest_image = &kexec_image;
|
|
dest_image = &kexec_image;
|
|
- if (flags & KEXEC_FILE_ON_CRASH)
|
|
|
|
|
|
+ if (flags & KEXEC_FILE_ON_CRASH) {
|
|
dest_image = &kexec_crash_image;
|
|
dest_image = &kexec_crash_image;
|
|
|
|
+ if (kexec_crash_image)
|
|
|
|
+ arch_kexec_unprotect_crashkres();
|
|
|
|
+ }
|
|
|
|
|
|
if (flags & KEXEC_FILE_UNLOAD)
|
|
if (flags & KEXEC_FILE_UNLOAD)
|
|
goto exchange;
|
|
goto exchange;
|
|
@@ -324,6 +327,9 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
|
|
exchange:
|
|
exchange:
|
|
image = xchg(dest_image, image);
|
|
image = xchg(dest_image, image);
|
|
out:
|
|
out:
|
|
|
|
+ if ((flags & KEXEC_FILE_ON_CRASH) && kexec_crash_image)
|
|
|
|
+ arch_kexec_protect_crashkres();
|
|
|
|
+
|
|
mutex_unlock(&kexec_mutex);
|
|
mutex_unlock(&kexec_mutex);
|
|
kimage_free(image);
|
|
kimage_free(image);
|
|
return ret;
|
|
return ret;
|