diff options
author | akpm@osdl.org <akpm@osdl.org> | 2005-05-01 11:58:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:58:35 -0400 |
commit | 119f657c72fc07d6fd28c61de59cfba1566970a9 (patch) | |
tree | 33c8070aa904c4919cf244cdcd7c01e54589bb9e /mm/mremap.c | |
parent | f021e9210185b46e41ec3a0e78ec1621e168eacb (diff) |
[PATCH] RLIMIT_AS checking fix
Address bug #4508: there's potential for wraparound in the various places
where we perform RLIMIT_AS checking.
(I'm a bit worried about acct_stack_growth(). Are we sure that vma->vm_mm is
always equal to current->mm? If not, then we're comparing some other
process's total_vm with the calling process's rlimits).
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r-- | mm/mremap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 0d1c1b9c7a0a..0dd7ace94e51 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -347,10 +347,10 @@ unsigned long do_mremap(unsigned long addr, | |||
347 | if (locked > lock_limit && !capable(CAP_IPC_LOCK)) | 347 | if (locked > lock_limit && !capable(CAP_IPC_LOCK)) |
348 | goto out; | 348 | goto out; |
349 | } | 349 | } |
350 | ret = -ENOMEM; | 350 | if (!may_expand_vm(current->mm, (new_len - old_len) >> PAGE_SHIFT)) { |
351 | if ((current->mm->total_vm << PAGE_SHIFT) + (new_len - old_len) | 351 | ret = -ENOMEM; |
352 | > current->signal->rlim[RLIMIT_AS].rlim_cur) | ||
353 | goto out; | 352 | goto out; |
353 | } | ||
354 | 354 | ||
355 | if (vma->vm_flags & VM_ACCOUNT) { | 355 | if (vma->vm_flags & VM_ACCOUNT) { |
356 | charged = (new_len - old_len) >> PAGE_SHIFT; | 356 | charged = (new_len - old_len) >> PAGE_SHIFT; |