From: Ma Wupeng mawupeng1@huawei.com
While testing mlock, we have a problem if the len of mlock is ULONG_MAX. The return value of mlock is zero. But nothing will be locked since the len in do_mlock overflows to zero due to the following code in mlock:
len = PAGE_ALIGN(len + (offset_in_page(start)));
The same problem happens in munlock.
Fix it by return -EINVAL if len overflows.
Ma Wupeng (1): mm/mlock: return EINVAL for illegal user memory range in mlock
mm/mlock.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)