diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 04:42:39 +0100 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 04:42:39 +0100 |
commit | 752c58a471c108d64da1676b2925dfbd83eb177e (patch) | |
tree | fbffa0d7c54cd812950dffc16d642c9d449f4faf /mm/mmap.c | |
parent | Input: drivers/char/keyboard.c - small cleanup in k_cur() (diff) | |
parent | Make sure "user->sigpending" count is in sync (diff) | |
download | linux-752c58a471c108d64da1676b2925dfbd83eb177e.tar.xz linux-752c58a471c108d64da1676b2925dfbd83eb177e.zip |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index eea8eefd51a8..497e502dfd6b 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -900,17 +900,6 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, int accountable = 1; unsigned long charged = 0, reqprot = prot; - if (file) { - if (is_file_hugepages(file)) - accountable = 0; - - if (!file->f_op || !file->f_op->mmap) - return -ENODEV; - - if ((prot & PROT_EXEC) && - (file->f_vfsmnt->mnt_flags & MNT_NOEXEC)) - return -EPERM; - } /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -1000,6 +989,16 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, case MAP_PRIVATE: if (!(file->f_mode & FMODE_READ)) return -EACCES; + if (file->f_vfsmnt->mnt_flags & MNT_NOEXEC) { + if (vm_flags & VM_EXEC) + return -EPERM; + vm_flags &= ~VM_MAYEXEC; + } + if (is_file_hugepages(file)) + accountable = 0; + + if (!file->f_op || !file->f_op->mmap) + return -ENODEV; break; default: |