aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/mmap.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index c04146da8efd..ed70a68e882a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1985,20 +1985,14 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
1985 if (!len) 1985 if (!len)
1986 return addr; 1986 return addr;
1987 1987
1988 if ((addr + len) > TASK_SIZE || (addr + len) < addr)
1989 return -EINVAL;
1990
1991 if (is_hugepage_only_range(mm, addr, len))
1992 return -EINVAL;
1993
1994 error = security_file_mmap(NULL, 0, 0, 0, addr, 1); 1988 error = security_file_mmap(NULL, 0, 0, 0, addr, 1);
1995 if (error) 1989 if (error)
1996 return error; 1990 return error;
1997 1991
1998 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 1992 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
1999 1993
2000 error = arch_mmap_check(addr, len, flags); 1994 error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
2001 if (error) 1995 if (error & ~PAGE_MASK)
2002 return error; 1996 return error;
2003 1997
2004 /* 1998 /*