From: Christian Borntraeger Date: Sat, 26 Jan 2008 13:11:16 +0000 (+0100) Subject: [S390] vmemmap: allocate struct pages before 1:1 mapping X-Git-Tag: v2.6.25-rc1~1228^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2fd64d6aaf498756f700eb1d07818efee046733;p=platform%2Fkernel%2Flinux-3.10.git [S390] vmemmap: allocate struct pages before 1:1 mapping We have seen an oops in an OOM situation, where show_mem tried to access the struct page of a dcss segment. The vmemmap code has already created the 1:1 mapping but failed allocating the struct pages. In the OOM case, show_mem now walks the memory. It uses pfn_valid to detect if it may access the struct page. In the case described above, the mapping was established and pfn_valid returned true. As the struct pages were not allocated, the kernel oopsed. We have to ensure that we have created the struct pages, before we add a mapping pointing to the pages. Signed-off-by: Christian Borntraeger Signed-off-by: Martin Schwidefsky --- diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c index 1fc9989..79d13a1 100644 --- a/arch/s390/mm/vmem.c +++ b/arch/s390/mm/vmem.c @@ -236,10 +236,10 @@ static int vmem_add_mem(unsigned long start, unsigned long size) { int ret; - ret = vmem_add_range(start, size); + ret = vmem_add_mem_map(start, size); if (ret) return ret; - return vmem_add_mem_map(start, size); + return vmem_add_range(start, size); } /*