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

Next file: linux/include/linux/smb.h
Previous file: linux/fs/smbfs/sock.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.26/linux/include/linux/mm.h linux/include/linux/mm.h
@@ -319,10 +319,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