diff options
| author | Randy Dunlap <randy.dunlap@oracle.com> | 2011-05-20 09:10:04 -0700 |
|---|---|---|
| committer | Randy Dunlap <randy.dunlap@oracle.com> | 2011-05-20 09:10:04 -0700 |
| commit | 2f3e4af471e38e0658e701973238ae4b5e50fcd6 (patch) | |
| tree | fbfc99c0d975e38ff80f4ff3239a9fc0567b8a4d /mm/memory.c | |
| parent | 61516587513c84ac26e68e3ab008dc6e965d0378 (diff) | |
| parent | d410fa4ef99112386de5f218dd7df7b4fca910b4 (diff) | |
Merge branch 'docs-security' into docs-move
Diffstat (limited to 'mm/memory.c')
| -rw-r--r-- | mm/memory.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/mm/memory.c b/mm/memory.c index 27f425378112..61e66f026563 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1412,9 +1412,8 @@ no_page_table: static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) { - return (vma->vm_flags & VM_GROWSDOWN) && - (vma->vm_start == addr) && - !vma_stack_continue(vma->vm_prev, addr); + return stack_guard_page_start(vma, addr) || + stack_guard_page_end(vma, addr+PAGE_SIZE); } /** @@ -1551,12 +1550,6 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, continue; } - /* - * For mlock, just skip the stack guard page. - */ - if ((gup_flags & FOLL_MLOCK) && stack_guard_page(vma, start)) - goto next_page; - do { struct page *page; unsigned int foll_flags = gup_flags; @@ -1573,6 +1566,11 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, int ret; unsigned int fault_flags = 0; + /* For mlock, just skip the stack guard page. */ + if (foll_flags & FOLL_MLOCK) { + if (stack_guard_page(vma, start)) + goto next_page; + } if (foll_flags & FOLL_WRITE) fault_flags |= FAULT_FLAG_WRITE; if (nonblocking) |
