diff options
Diffstat (limited to 'mm/mlock.c')
-rw-r--r-- | mm/mlock.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/mlock.c b/mm/mlock.c index 2b8335a89400..8f4e2dfceec1 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -25,7 +25,7 @@ int can_do_mlock(void) | |||
25 | { | 25 | { |
26 | if (capable(CAP_IPC_LOCK)) | 26 | if (capable(CAP_IPC_LOCK)) |
27 | return 1; | 27 | return 1; |
28 | if (current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur != 0) | 28 | if (rlimit(RLIMIT_MEMLOCK) != 0) |
29 | return 1; | 29 | return 1; |
30 | return 0; | 30 | return 0; |
31 | } | 31 | } |
@@ -487,7 +487,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) | |||
487 | locked = len >> PAGE_SHIFT; | 487 | locked = len >> PAGE_SHIFT; |
488 | locked += current->mm->locked_vm; | 488 | locked += current->mm->locked_vm; |
489 | 489 | ||
490 | lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; | 490 | lock_limit = rlimit(RLIMIT_MEMLOCK); |
491 | lock_limit >>= PAGE_SHIFT; | 491 | lock_limit >>= PAGE_SHIFT; |
492 | 492 | ||
493 | /* check against resource limits */ | 493 | /* check against resource limits */ |
@@ -550,7 +550,7 @@ SYSCALL_DEFINE1(mlockall, int, flags) | |||
550 | 550 | ||
551 | down_write(¤t->mm->mmap_sem); | 551 | down_write(¤t->mm->mmap_sem); |
552 | 552 | ||
553 | lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; | 553 | lock_limit = rlimit(RLIMIT_MEMLOCK); |
554 | lock_limit >>= PAGE_SHIFT; | 554 | lock_limit >>= PAGE_SHIFT; |
555 | 555 | ||
556 | ret = -ENOMEM; | 556 | ret = -ENOMEM; |
@@ -584,7 +584,7 @@ int user_shm_lock(size_t size, struct user_struct *user) | |||
584 | int allowed = 0; | 584 | int allowed = 0; |
585 | 585 | ||
586 | locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | 586 | locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; |
587 | lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; | 587 | lock_limit = rlimit(RLIMIT_MEMLOCK); |
588 | if (lock_limit == RLIM_INFINITY) | 588 | if (lock_limit == RLIM_INFINITY) |
589 | allowed = 1; | 589 | allowed = 1; |
590 | lock_limit >>= PAGE_SHIFT; | 590 | lock_limit >>= PAGE_SHIFT; |
@@ -618,12 +618,12 @@ int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | |||
618 | 618 | ||
619 | down_write(&mm->mmap_sem); | 619 | down_write(&mm->mmap_sem); |
620 | 620 | ||
621 | lim = rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; | 621 | lim = ACCESS_ONCE(rlim[RLIMIT_AS].rlim_cur) >> PAGE_SHIFT; |
622 | vm = mm->total_vm + pgsz; | 622 | vm = mm->total_vm + pgsz; |
623 | if (lim < vm) | 623 | if (lim < vm) |
624 | goto out; | 624 | goto out; |
625 | 625 | ||
626 | lim = rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; | 626 | lim = ACCESS_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur) >> PAGE_SHIFT; |
627 | vm = mm->locked_vm + pgsz; | 627 | vm = mm->locked_vm + pgsz; |
628 | if (lim < vm) | 628 | if (lim < vm) |
629 | goto out; | 629 | goto out; |