diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-03 21:23:11 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 12:44:58 +0100 |
commit | 9206de95b1ea68357996ec02be5db0638a0de2c1 (patch) | |
tree | e32b41a06a8465af0e8cfa0660b517930cc2fea5 /mm/mmap.c | |
parent | fix a struct file leak in do_mmap_pgoff() (diff) | |
download | linux-9206de95b1ea68357996ec02be5db0638a0de2c1.tar.xz linux-9206de95b1ea68357996ec02be5db0638a0de2c1.zip |
Take arch_mmap_check() into get_unmapped_area()
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 5076775a395c..c04146da8efd 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -931,13 +931,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, if (!(flags & MAP_FIXED)) addr = round_hint_to_min(addr); - error = arch_mmap_check(addr, len, flags); - if (error) - return error; - /* Careful about overflows.. */ len = PAGE_ALIGN(len); - if (!len || len > TASK_SIZE) + if (!len) return -ENOMEM; /* offset overflow? */ @@ -1437,6 +1433,14 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long (*get_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); + unsigned long error = arch_mmap_check(addr, len, flags); + if (error) + return error; + + /* Careful about overflows.. */ + if (len > TASK_SIZE) + return -ENOMEM; + get_area = current->mm->get_unmapped_area; if (file && file->f_op && file->f_op->get_unmapped_area) get_area = file->f_op->get_unmapped_area; |