From 731ff9643911aedb5ec3e1535120ed0b0aace6a2 Mon Sep 17 00:00:00 2001 From: Matt Sealey Date: Sat, 28 Aug 2010 16:03:17 -0500 Subject: [PATCH] Revert "mm: fix page table unmap for stack guard page properly" This reverts commit 1cb5bb4cb224279b526572fa4143f7972bd159e6. --- mm/memory.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 03546672037..1fe2a2b90da 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2644,23 +2644,24 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, spinlock_t *ptl; pte_t entry; - pte_unmap(page_table); - - /* Check if we need to add a guard page to the stack */ - if (check_stack_guard_page(vma, address) < 0) + if (check_stack_guard_page(vma, address) < 0) { + pte_unmap(page_table); return VM_FAULT_SIGBUS; + } - /* Use the zero-page for reads */ if (!(flags & FAULT_FLAG_WRITE)) { entry = pte_mkspecial(pfn_pte(my_zero_pfn(address), vma->vm_page_prot)); - page_table = pte_offset_map_lock(mm, pmd, address, &ptl); + ptl = pte_lockptr(mm, pmd); + spin_lock(ptl); if (!pte_none(*page_table)) goto unlock; goto setpte; } /* Allocate our own private page. */ + pte_unmap(page_table); + if (unlikely(anon_vma_prepare(vma))) goto oom; page = alloc_zeroed_user_highpage_movable(vma, address);