Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / mm / mlock.c
index 9fa54d9..a6d2762 100644 (file)
@@ -61,7 +61,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
        struct vm_area_struct * vma, * next;
        int error;
 
-       if (on && !capable(CAP_IPC_LOCK))
+       if (on && !can_do_mlock())
                return -EPERM;
        len = PAGE_ALIGN(len);
        end = start + len;
@@ -121,7 +121,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
        lock_limit >>= PAGE_SHIFT;
 
        /* check against resource limits */
-       if (locked <= lock_limit)
+       if ( (locked <= lock_limit) || capable(CAP_IPC_LOCK))
                error = do_mlock(start, len, 1);
 out:
        up_write(&current->mm->mmap_sem);
@@ -146,7 +146,7 @@ static int do_mlockall(int flags)
        unsigned int def_flags;
        struct vm_area_struct * vma;
 
-       if (!capable(CAP_IPC_LOCK))
+       if (!can_do_mlock())
                return -EPERM;
 
        def_flags = 0;