]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - mm/swapfile.c
mm: collapse security_vm_enough_memory() variants into a single function
[linux-3.10.git] / mm / swapfile.c
index d999f090dfdabb6e5282aaaf3429029c5e3f839d..f0d79296dd55a83fafac61bb0cd680e5538a5d40 100644 (file)
@@ -1563,6 +1563,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
+       BUG_ON(!current->mm);
+
        pathname = getname(specialfile);
        err = PTR_ERR(pathname);
        if (IS_ERR(pathname))
@@ -1590,7 +1592,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
                spin_unlock(&swap_lock);
                goto out_dput;
        }
-       if (!security_vm_enough_memory(p->pages))
+       if (!security_vm_enough_memory_mm(current->mm, p->pages))
                vm_unacct_memory(p->pages);
        else {
                err = -ENOMEM;