Skip to content

Commit

Permalink
[S390] vmemmap: allocate struct pages before 1:1 mapping
Browse files Browse the repository at this point in the history
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 <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Christian Borntraeger authored and Martin Schwidefsky committed Jan 26, 2008
1 parent d09293a commit a2fd64d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/s390/mm/vmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit a2fd64d

Please sign in to comment.