Commit 9e151e54 authored by Linus Torvalds's avatar Linus Torvalds

Fix mmap cornercase with wrong return value for invalid "len".

parent 711f6f98
......@@ -398,12 +398,14 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned lon
if (file && (!file->f_op || !file->f_op->mmap))
return -ENODEV;
if ((len = PAGE_ALIGN(len)) == 0)
if (!len)
return addr;
if (len > TASK_SIZE)
return -EINVAL;
len = PAGE_ALIGN(len);
/* offset overflow? */
if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment