aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 6793b9c68107..a472bcd4b061 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2765,16 +2765,26 @@ int make_pages_present(unsigned long addr, unsigned long end)
2765 2765
2766 vma = find_vma(current->mm, addr); 2766 vma = find_vma(current->mm, addr);
2767 if (!vma) 2767 if (!vma)
2768 return -1; 2768 return -ENOMEM;
2769 write = (vma->vm_flags & VM_WRITE) != 0; 2769 write = (vma->vm_flags & VM_WRITE) != 0;
2770 BUG_ON(addr >= end); 2770 BUG_ON(addr >= end);
2771 BUG_ON(end > vma->vm_end); 2771 BUG_ON(end > vma->vm_end);
2772 len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE; 2772 len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
2773 ret = get_user_pages(current, current->mm, addr, 2773 ret = get_user_pages(current, current->mm, addr,
2774 len, write, 0, NULL, NULL); 2774 len, write, 0, NULL, NULL);
2775 if (ret < 0) 2775 if (ret < 0) {
2776 /*
2777 SUS require strange return value to mlock
2778 - invalid addr generate to ENOMEM.
2779 - out of memory should generate EAGAIN.
2780 */
2781 if (ret == -EFAULT)
2782 ret = -ENOMEM;
2783 else if (ret == -ENOMEM)
2784 ret = -EAGAIN;
2776 return ret; 2785 return ret;
2777 return ret == len ? 0 : -1; 2786 }
2787 return ret == len ? 0 : -ENOMEM;
2778} 2788}
2779 2789
2780#if !defined(__HAVE_ARCH_GATE_AREA) 2790#if !defined(__HAVE_ARCH_GATE_AREA)