diff options
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 21b56945c5d2..dae42f380d6e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1561,6 +1561,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) | |||
1561 | if (!capable(CAP_SYS_ADMIN)) | 1561 | if (!capable(CAP_SYS_ADMIN)) |
1562 | return -EPERM; | 1562 | return -EPERM; |
1563 | 1563 | ||
1564 | BUG_ON(!current->mm); | ||
1565 | |||
1564 | pathname = getname(specialfile); | 1566 | pathname = getname(specialfile); |
1565 | err = PTR_ERR(pathname); | 1567 | err = PTR_ERR(pathname); |
1566 | if (IS_ERR(pathname)) | 1568 | if (IS_ERR(pathname)) |
@@ -1588,7 +1590,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) | |||
1588 | spin_unlock(&swap_lock); | 1590 | spin_unlock(&swap_lock); |
1589 | goto out_dput; | 1591 | goto out_dput; |
1590 | } | 1592 | } |
1591 | if (!security_vm_enough_memory(p->pages)) | 1593 | if (!security_vm_enough_memory_mm(current->mm, p->pages)) |
1592 | vm_unacct_memory(p->pages); | 1594 | vm_unacct_memory(p->pages); |
1593 | else { | 1595 | else { |
1594 | err = -ENOMEM; | 1596 | err = -ENOMEM; |