patch-2.1.12 linux/ipc/shm.c
Next file: linux/kernel/module.c
Previous file: linux/include/net/x25call.h
Back to the patch index
Back to the overall index
- Lines: 13
- Date:
Fri Nov 22 16:23:54 1996
- Orig file:
v2.1.11/linux/ipc/shm.c
- Orig date:
Tue Oct 29 19:58:47 1996
diff -u --recursive --new-file v2.1.11/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