path: root/kernel
diff options
authorMinfei Huang <>2016-05-23 16:24:16 -0700
committerLinus Torvalds <>2016-05-23 17:04:14 -0700
commit917a35605f09c0d16aeb2e92c7fbff562e19a116 (patch)
treea81b2b758679dbbde9509b7071930f16deb9b098 /kernel
parent1e5768ae7500e7ce6eb73e1b263574d5c19606cf (diff)
kexec: make a pair of map/unmap reserved pages in error path
For some arch, kexec shall map the reserved pages, then use them, when we try to start the kdump service. kexec may return directly, without unmaping the reserved pages, if it fails during starting service. To fix it, we make a pair of map/unmap reserved pages both in generic path and error path. This patch only affects s390. Other architecturess don't implement the interface of crash_unmap_reserved_pages and crash_map_reserved_pages. It isn't a urgent patch. Kernel can work well without any risk, although the reserved pages are not unmapped before returning in error path. Signed-off-by: Minfei Huang <> Cc: Vivek Goyal <> Cc: "Eric W. Biederman" <> Cc: Xunlei Pang <> Cc: Baoquan He <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'kernel')
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c
index b44cb3f5a15c..4b49aa71304f 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -194,22 +194,25 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
segments, flags);
if (result)
- goto out;
+ goto unmap_page;
image->preserve_context = 1;
result = machine_kexec_prepare(image);
if (result)
- goto out;
+ goto unmap_page;
for (i = 0; i < nr_segments; i++) {
result = kimage_load_segment(image, &image->segment[i]);
if (result)
- goto out;
+ goto unmap_page;
if (flags & KEXEC_ON_CRASH)
+ if (result)
+ goto out;
/* Install the new kernel, and Uninstall the old */
image = xchg(dest_image, image);