summaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2012-02-12 22:58:52 -0500
committerJames Morris <jmorris@namei.org>2012-02-13 18:45:39 -0500
commit191c542442fdf53cc3c496c00be13367fd9cd42d (patch)
tree4aef9e33a1d99e6530b704243efbe373bb314d61 /mm/swapfile.c
parentbbd36568594d091e682a1975ef4ee41d808de0bc (diff)
mm: collapse security_vm_enough_memory() variants into a single function
Collapse security_vm_enough_memory() variants into a single function. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d999f090dfda..f0d79296dd55 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1563,6 +1563,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
1563 if (!capable(CAP_SYS_ADMIN)) 1563 if (!capable(CAP_SYS_ADMIN))
1564 return -EPERM; 1564 return -EPERM;
1565 1565
1566 BUG_ON(!current->mm);
1567
1566 pathname = getname(specialfile); 1568 pathname = getname(specialfile);
1567 err = PTR_ERR(pathname); 1569 err = PTR_ERR(pathname);
1568 if (IS_ERR(pathname)) 1570 if (IS_ERR(pathname))
@@ -1590,7 +1592,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
1590 spin_unlock(&swap_lock); 1592 spin_unlock(&swap_lock);
1591 goto out_dput; 1593 goto out_dput;
1592 } 1594 }
1593 if (!security_vm_enough_memory(p->pages)) 1595 if (!security_vm_enough_memory_mm(current->mm, p->pages))
1594 vm_unacct_memory(p->pages); 1596 vm_unacct_memory(p->pages);
1595 else { 1597 else {
1596 err = -ENOMEM; 1598 err = -ENOMEM;