patch-2.2.12 linux/ipc/shm.c

Next file: linux/kernel/exit.c
Previous file: linux/include/net/tcp.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.11/linux/ipc/shm.c linux/ipc/shm.c
@@ -401,8 +401,9 @@
 
 	/* add new mapping */
 	tmp = shmd->vm_end - shmd->vm_start;
-	if((current->mm->total_vm << PAGE_SHIFT) + tmp
-	   > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur)
+	if ((current->rlim[RLIMIT_AS].rlim_cur < RLIM_INFINITY) && 
+	   ((current->mm->total_vm << PAGE_SHIFT) + tmp
+	   > current->rlim[RLIMIT_AS].rlim_cur))
 		return -ENOMEM;
 	current->mm->total_vm += tmp >> PAGE_SHIFT;
 	insert_vm_struct(current->mm, shmd);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)