Merge tag 'samsung-fixes-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / kernel / kexec_file.c
index c72d2ff..503bc2d 100644 (file)
@@ -274,8 +274,11 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
                return -EBUSY;
 
        dest_image = &kexec_image;
-       if (flags & KEXEC_FILE_ON_CRASH)
+       if (flags & KEXEC_FILE_ON_CRASH) {
                dest_image = &kexec_crash_image;
+               if (kexec_crash_image)
+                       arch_kexec_unprotect_crashkres();
+       }
 
        if (flags & KEXEC_FILE_UNLOAD)
                goto exchange;
@@ -324,6 +327,9 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
 exchange:
        image = xchg(dest_image, image);
 out:
+       if ((flags & KEXEC_FILE_ON_CRASH) && kexec_crash_image)
+               arch_kexec_protect_crashkres();
+
        mutex_unlock(&kexec_mutex);
        kimage_free(image);
        return ret;