From: Gerd Knorr <kraxel@bytesex.org>

2.5.x kernels don't look at the VM_DONTEXPAND flag when merging multiple vmas
into one.  Fix below.



 25-akpm/mm/mmap.c |    4 ++++
 1 files changed, 4 insertions(+)

diff -puN mm/mmap.c~VM_DONTEXPAND-fix mm/mmap.c
--- 25/mm/mmap.c~VM_DONTEXPAND-fix	Fri Mar 21 16:33:13 2003
+++ 25-akpm/mm/mmap.c	Fri Mar 21 16:33:13 2003
@@ -374,6 +374,8 @@ static int
 can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
 	struct file *file, unsigned long vm_pgoff, unsigned long size)
 {
+	if ((vma->vm_flags & VM_DONTEXPAND) || (vm_flags & VM_DONTEXPAND))
+		return 0;
 	if (vma->vm_file == file && vma->vm_flags == vm_flags) {
 		if (!file)
 			return 1;	/* anon mapping */
@@ -391,6 +393,8 @@ static int
 can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
 	struct file *file, unsigned long vm_pgoff)
 {
+	if ((vma->vm_flags & VM_DONTEXPAND) || (vm_flags & VM_DONTEXPAND))
+		return 0;
 	if (vma->vm_file == file && vma->vm_flags == vm_flags) {
 		unsigned long vma_size;
 

_