Commit 24c79d8e authored by Krzysztof Opasiak's avatar Krzysztof Opasiak Committed by Linus Torvalds

mm: use dedicated helper to access rlimit value

Use rlimit() helper instead of manually writing whole chain from current
task to rlim_cur.

Link: http://lkml.kernel.org/r/20170705172811.8027-1-k.opasiak@samsung.comSigned-off-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b17c070f
...@@ -2177,7 +2177,6 @@ static int acct_stack_growth(struct vm_area_struct *vma, ...@@ -2177,7 +2177,6 @@ static int acct_stack_growth(struct vm_area_struct *vma,
unsigned long size, unsigned long grow) unsigned long size, unsigned long grow)
{ {
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
struct rlimit *rlim = current->signal->rlim;
unsigned long new_start; unsigned long new_start;
/* address space limit tests */ /* address space limit tests */
...@@ -2185,7 +2184,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, ...@@ -2185,7 +2184,7 @@ static int acct_stack_growth(struct vm_area_struct *vma,
return -ENOMEM; return -ENOMEM;
/* Stack limit test */ /* Stack limit test */
if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) if (size > rlimit(RLIMIT_STACK))
return -ENOMEM; return -ENOMEM;
/* mlock limit tests */ /* mlock limit tests */
...@@ -2193,7 +2192,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, ...@@ -2193,7 +2192,7 @@ static int acct_stack_growth(struct vm_area_struct *vma,
unsigned long locked; unsigned long locked;
unsigned long limit; unsigned long limit;
locked = mm->locked_vm + grow; locked = mm->locked_vm + grow;
limit = READ_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur); limit = rlimit(RLIMIT_MEMLOCK);
limit >>= PAGE_SHIFT; limit >>= PAGE_SHIFT;
if (locked > limit && !capable(CAP_IPC_LOCK)) if (locked > limit && !capable(CAP_IPC_LOCK))
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment