]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/kdump-x86-sparsemem.diff
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / kdump-x86-sparsemem.diff
CommitLineData
8f69975d
BS
1From e7706fc691513b0f06adb3de3d6ac04293180146 Mon Sep 17 00:00:00 2001
2From: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
3Date: Mon, 20 Oct 2008 13:51:52 +0900
4Subject: [PATCH] x86, kdump: fix invalid access on i386 sparsemem
5References: bnc#440525
6
7Impact: fix kdump crash on 32-bit sparsemem kernels
8
9Since linux-2.6.27, kdump has failed on i386 sparsemem kernel.
101st-kernel gets a panic just before switching to 2nd-kernel.
11
12The cause is that a kernel accesses invalid mem_section by
13page_to_pfn(image->swap_page) at machine_kexec().
14image->swap_page is allocated if kexec for hibernation, but
15it is not allocated if kdump. So if kdump, a kernel should
16not access the mem_section corresponding to image->swap_page.
17
18The attached patch fixes this invalid access.
19
20Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
21Cc: kexec-ml <kexec@lists.infradead.org>
22Cc: Andrew Morton <akpm@linux-foundation.org>
23Signed-off-by: Ingo Molnar <mingo@elte.hu>
24Acked-by: Bernhard Walle <bwalle@suse.de>
25
26diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
27index 0732adb..7a38574 100644
28--- a/arch/x86/kernel/machine_kexec_32.c
29+++ b/arch/x86/kernel/machine_kexec_32.c
30@@ -162,7 +162,10 @@ void machine_kexec(struct kimage *image)
31 page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
32 page_list[PA_PTE_1] = __pa(kexec_pte1);
33 page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
34- page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT);
35+
36+ if (image->type == KEXEC_TYPE_DEFAULT)
37+ page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
38+ << PAGE_SHIFT);
39
40 /* The segment registers are funny things, they have both a
41 * visible and an invisible part. Whenever the visible part is