Commit c11d69d8 authored by Lee Schermerhorn's avatar Lee Schermerhorn Committed by Linus Torvalds

mlock: revert mainline handling of mlock error return

This change is intended to make mlock() error returns correct.
make_page_present() is a lower level function used by more than mlock().
Subsequent patch[es] will add this error return fixup in an mlock specific
path.

Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: default avatarLee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e0f79b8f
...@@ -2819,19 +2819,9 @@ int make_pages_present(unsigned long addr, unsigned long end) ...@@ -2819,19 +2819,9 @@ int make_pages_present(unsigned long addr, unsigned long end)
len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE; len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
ret = get_user_pages(current, current->mm, addr, ret = get_user_pages(current, current->mm, addr,
len, write, 0, NULL, NULL); len, write, 0, NULL, NULL);
if (ret < 0) { if (ret < 0)
/*
SUS require strange return value to mlock
- invalid addr generate to ENOMEM.
- out of memory should generate EAGAIN.
*/
if (ret == -EFAULT)
ret = -ENOMEM;
else if (ret == -ENOMEM)
ret = -EAGAIN;
return ret; return ret;
} return ret == len ? 0 : -1;
return ret == len ? 0 : -ENOMEM;
} }
#if !defined(__HAVE_ARCH_GATE_AREA) #if !defined(__HAVE_ARCH_GATE_AREA)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment