]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmap: EINVAL not ENOMEM when rejecting VM_GROWS
authorHugh Dickins <hughd@google.com>
Tue, 6 Mar 2012 20:28:52 +0000 (12:28 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Mar 2012 21:49:08 +0000 (13:49 -0800)
Currently error is -ENOMEM when rejecting VM_GROWSDOWN|VM_GROWSUP
from shared anonymous: hoist the file case's -EINVAL up for both.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c

index 22e1a0b2f70c3f08428035d74e4ca9088924ba54..09ce2cae07ca3c092507b9f5727cd8ac61967317 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1266,8 +1266,9 @@ munmap_back:
        vma->vm_pgoff = pgoff;
        INIT_LIST_HEAD(&vma->anon_vma_chain);
 
+       error = -EINVAL;        /* when rejecting VM_GROWSDOWN|VM_GROWSUP */
+
        if (file) {
-               error = -EINVAL;
                if (vm_flags & (VM_GROWSDOWN|VM_GROWSUP))
                        goto free_vma;
                if (vm_flags & VM_DENYWRITE) {