diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2012-02-13 07:58:52 +0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2012-02-14 03:45:39 +0400 |
commit | 191c542442fdf53cc3c496c00be13367fd9cd42d (patch) | |
tree | 4aef9e33a1d99e6530b704243efbe373bb314d61 /mm/swapfile.c | |
parent | bbd36568594d091e682a1975ef4ee41d808de0bc (diff) | |
download | linux-191c542442fdf53cc3c496c00be13367fd9cd42d.tar.xz |
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.c | 4 |
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) 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; |