patch-2.0.27 linux/mm/mmap.c
Next file: linux/mm/mremap.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index
- Lines: 30
- Date:
Fri Nov 22 16:25:17 1996
- Orig file:
v2.0.26/linux/mm/mmap.c
- Orig date:
Wed Sep 11 17:57:19 1996
diff -u --recursive --new-file v2.0.26/linux/mm/mmap.c linux/mm/mmap.c
@@ -107,11 +107,11 @@
/*
* Ok, looks good - let it rip.
*/
- mm->brk = brk;
- do_mmap(NULL, oldbrk, newbrk-oldbrk,
+ if(do_mmap(NULL, oldbrk, newbrk-oldbrk,
PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_FIXED|MAP_PRIVATE, 0);
- return brk;
+ MAP_FIXED|MAP_PRIVATE, 0) != oldbrk)
+ return mm->brk;
+ return mm->brk = brk;
}
/*
@@ -252,6 +252,13 @@
vma->vm_pte = 0;
do_munmap(addr, len); /* Clear old maps */
+
+ /* Check against address space limit. */
+ if ((mm->total_vm << PAGE_SHIFT) + len
+ > current->rlim[RLIMIT_AS].rlim_cur) {
+ kfree(vma);
+ return -ENOMEM;
+ }
/* Private writable mapping? Check memory availability.. */
if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov