]> git.neil.brown.name Git - history.git/commitdiff
Fix the PROT_EXEC breakage on anonymous mmap.
authorLinus Torvalds <torvalds@home.osdl.org>
Sat, 6 Dec 2003 06:34:40 +0000 (22:34 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Sat, 6 Dec 2003 06:34:40 +0000 (22:34 -0800)
Clean up the tests while at it.

mm/mmap.c

index 7a3a68e52afebcd072155a523a161acb51b45239..5b2e70ba6450361e9bf8da732cac08504f50dc8f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -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;