Commit 8255b244 authored by Linus Torvalds's avatar Linus Torvalds

Fix the PROT_EXEC breakage on anonymous mmap.

Clean up the tests while at it.
parent 58d11a39
......@@ -475,11 +475,13 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
struct rb_node ** rb_link, * rb_parent;
unsigned long charged = 0;
if (file && (!file->f_op || !file->f_op->mmap))
return -ENODEV;
if (file) {
if (!file->f_op || !file->f_op->mmap)
return -ENODEV;
if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
return -EPERM;
if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
return -EPERM;
}
if (!len)
return addr;
......
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