patch-2.0.27 linux/mm/mremap.c
Next file: linux/net/ipv4/tcp.c
Previous file: linux/mm/mmap.c
Back to the patch index
Back to the overall index
- Lines: 18
- Date:
Fri Nov 22 16:25:17 1996
- Orig file:
v2.0.26/linux/mm/mremap.c
- Orig date:
Wed Sep 11 17:57:19 1996
diff -u --recursive --new-file v2.0.26/linux/mm/mremap.c linux/mm/mremap.c
@@ -146,6 +146,7 @@
insert_vm_struct(current->mm, new_vma);
merge_segments(current->mm, new_vma->vm_start, new_vma->vm_end);
do_munmap(addr, old_len);
+ current->mm->total_vm += new_len >> PAGE_SHIFT;
return new_addr;
}
kfree(new_vma);
@@ -192,6 +193,9 @@
if (locked > current->rlim[RLIMIT_MEMLOCK].rlim_cur)
return -EAGAIN;
}
+ if ((current->mm->total_vm << PAGE_SHIFT) + (new_len - old_len)
+ > current->rlim[RLIMIT_AS].rlim_cur)
+ return -ENOMEM;
/* old_len exactly to the end of the area.. */
if (old_len == vma->vm_end - addr &&
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov