patch-2.1.12 linux/include/linux/mm.h

Next file: linux/include/linux/nfs_fs.h
Previous file: linux/include/linux/linear.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.11/linux/include/linux/mm.h linux/include/linux/mm.h
@@ -308,10 +308,12 @@
 	unsigned long grow;
 
 	address &= PAGE_MASK;
+	grow = vma->vm_start - address;
 	if (vma->vm_end - address
-	    > (unsigned long) current->rlim[RLIMIT_STACK].rlim_cur)
+	    > (unsigned long) current->rlim[RLIMIT_STACK].rlim_cur ||
+	    (vma->vm_mm->total_vm << PAGE_SHIFT) + grow
+	    > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur)
 		return -ENOMEM;
-	grow = vma->vm_start - address;
 	vma->vm_start = address;
 	vma->vm_offset -= grow;
 	vma->vm_mm->total_vm += grow >> PAGE_SHIFT;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov