Setting tag linux-2.6-27-38
[linux-2.6.git] / delta-vx_rss_avail.patch
1
2     the check_stack_guard_page() has, under certain circumstances, side-effects which can not easily be undone in case the vx_rss_avail() fails
3
4 diff --git a/mm/memory.c b/mm/memory.c
5 index c53939d..158c500 100644
6 --- a/mm/memory.c
7 +++ b/mm/memory.c
8 @@ -2439,13 +2439,14 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
9  
10         pte_unmap(page_table);
11  
12 +       if (!vx_rss_avail(mm, 1))
13 +               goto oom;
14 +
15         /* Check if we need to add a guard page to the stack */
16         if (check_stack_guard_page(vma, address) < 0)
17                 return VM_FAULT_SIGBUS;
18  
19         /* Allocate our own private page. */
20 -       if (!vx_rss_avail(mm, 1))
21 -               goto oom;
22         if (unlikely(anon_vma_prepare(vma)))
23                 goto oom;
24         page = alloc_zeroed_user_highpage_movable(vma, address);