Commit 9a01ab03 authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds

[PATCH] mlockall(MCL_FUTURE) unlocks currently locked mappings

Calling mlockall(MCL_FUTURE) will erroneously unlock any currently locked
mappings.  Fix this up, and while we're at it, remove the essentially
unused error variable.
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d5cee1cc
...@@ -138,7 +138,6 @@ asmlinkage long sys_munlock(unsigned long start, size_t len) ...@@ -138,7 +138,6 @@ asmlinkage long sys_munlock(unsigned long start, size_t len)
static int do_mlockall(int flags) static int do_mlockall(int flags)
{ {
int error;
unsigned int def_flags; unsigned int def_flags;
struct vm_area_struct * vma; struct vm_area_struct * vma;
...@@ -149,8 +148,9 @@ static int do_mlockall(int flags) ...@@ -149,8 +148,9 @@ static int do_mlockall(int flags)
if (flags & MCL_FUTURE) if (flags & MCL_FUTURE)
def_flags = VM_LOCKED; def_flags = VM_LOCKED;
current->mm->def_flags = def_flags; current->mm->def_flags = def_flags;
if (flags == MCL_FUTURE)
goto out;
error = 0;
for (vma = current->mm->mmap; vma ; vma = vma->vm_next) { for (vma = current->mm->mmap; vma ; vma = vma->vm_next) {
unsigned int newflags; unsigned int newflags;
...@@ -161,7 +161,8 @@ static int do_mlockall(int flags) ...@@ -161,7 +161,8 @@ static int do_mlockall(int flags)
/* Ignore errors */ /* Ignore errors */
mlock_fixup(vma, vma->vm_start, vma->vm_end, newflags); mlock_fixup(vma, vma->vm_start, vma->vm_end, newflags);
} }
return error; out:
return 0;
} }
asmlinkage long sys_mlockall(int flags) asmlinkage long sys_mlockall(int flags)
......
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