mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
mm: use rlimit helpers
Make sure compiler won't do weird things with limits. E.g. fetching them
twice may return 2 different values after writable limits are implemented.
I.e. either use rlimit helpers added in
3e10e716ab ("resource: add helpers for
fetching rlimits") or ACCESS_ONCE if not applicable.
Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
06f9d8c2b5
commit
59e99e5b97
4 changed files with 15 additions and 14 deletions
|
|
@ -285,7 +285,7 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr,
|
|||
if (vma->vm_flags & VM_LOCKED) {
|
||||
unsigned long locked, lock_limit;
|
||||
locked = mm->locked_vm << PAGE_SHIFT;
|
||||
lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
|
||||
lock_limit = rlimit(RLIMIT_MEMLOCK);
|
||||
locked += new_len - old_len;
|
||||
if (locked > lock_limit && !capable(CAP_IPC_LOCK))
|
||||
goto Eagain;
|
||||
|
|
|
|||
Loading…
Reference in a new issue