History

kexec: fix OOPS in crash_kernel_shrink

Two "echo 0 > /sys/kernel/kexec_crash_size" OOPSes kernel. Also content of this file is invalid after first shrink to zero: it shows 1 instead of 0. This scenario is unlikely to happen often (root privs, valid crashkernel= in cmdline, dump-capture kernel not loaded), I hit it only by chance. This patch fixes it.

Vitaly Mayatskikh committed 16 years ago

Commit 475f9aa1 parent d586ebb1 file · +2 −4Browse files

Unified · Split

kernel/kexec.c+2−4
@@ -1134,11 +1134,9 @@ int crash_shrink_memory(unsigned long new_size) · 1133 unmodified lines
1134 1134
1135 free_reserved_phys_range(end, crashk_res.end);1135 free_reserved_phys_range(end, crashk_res.end);
1136 1136
1137 if (start == end) {1137 if (start == end)
1138 crashk_res.end = end;
1139 release_resource(&crashk_res);1138 release_resource(&crashk_res);
1140 } else1139 crashk_res.end = end - 1;
1141 crashk_res.end = end - 1;
1142 1140
1143unlock:1141unlock:
1144 mutex_unlock(&kexec_mutex);1142 mutex_unlock(&kexec_mutex);