VM_GROWS{UP,DOWN} shouldn't be set on shmem VMAs
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 5 Mar 2012 06:39:47 +0000 (06:39 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 5 Mar 2012 21:51:32 +0000 (13:51 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c

index 3f758c7f4c815c2b0edf494526b2823b41fbc142..22e1a0b2f70c3f08428035d74e4ca9088924ba54 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1293,6 +1293,8 @@ munmap_back:
                pgoff = vma->vm_pgoff;
                vm_flags = vma->vm_flags;
        } else if (vm_flags & VM_SHARED) {
+               if (unlikely(vm_flags & (VM_GROWSDOWN|VM_GROWSUP)))
+                       goto free_vma;
                error = shmem_zero_setup(vma);
                if (error)
                        goto free_vma;