Merge branch 'akpm' (Andrew's patch-bomb)
[~shefty/rdma-dev.git] / mm / swapfile.c
index 21b56945c5d22e81b756381481e18937e2ce3269..dae42f380d6ebcde88d3aaef6aa3cb1d64e0f5a3 100644 (file)
@@ -1561,6 +1561,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))
@@ -1588,7 +1590,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;