Skip to content

Commit

Permalink
mmap: EINVAL not ENOMEM when rejecting VM_GROWS
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Mar 6, 2012
1 parent 917ec63 commit ce8fea7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
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) {
Expand Down

0 comments on commit ce8fea7

Please sign in to comment.