patch-2.0.27 linux/ipc/shm.c
Next file: linux/mm/mmap.c
Previous file: linux/init/main.c
Back to the patch index
Back to the overall index
- Lines: 13
- Date:
Fri Nov 22 16:25:18 1996
- Orig file:
v2.0.26/linux/ipc/shm.c
- Orig date:
Wed Sep 11 17:57:18 1996
diff -u --recursive --new-file v2.0.26/linux/ipc/shm.c linux/ipc/shm.c
@@ -424,7 +424,11 @@
do_munmap(shmd->vm_start, shmd->vm_end - shmd->vm_start);
/* add new mapping */
- current->mm->total_vm += (shmd->vm_end - shmd->vm_start) >> PAGE_SHIFT;
+ tmp = shmd->vm_end - shmd->vm_start;
+ if((current->mm->total_vm << PAGE_SHIFT) + tmp
+ > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur)
+ return -ENOMEM;
+ current->mm->total_vm += tmp >> PAGE_SHIFT;
insert_vm_struct(current->mm, shmd);
merge_segments(current->mm, shmd->vm_start, shmd->vm_end);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov