aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-11-22 13:06:44 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-11-22 13:06:44 -0500
commit0bd2af46839ad6262d25714a6ec0365db9d6b98f (patch)
treedcced72d230d69fd0c5816ac6dd03ab84799a93e /mm/mmap.c
parente138a5d2356729b8752e88520cc1525fae9794ac (diff)
parentf26b90440cd74c78fe10c9bd5160809704a9627c (diff)
Merge ../scsi-rc-fixes-2.6
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index eea8eefd51a8..7b40abd7cba2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -900,17 +900,6 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
900 int accountable = 1; 900 int accountable = 1;
901 unsigned long charged = 0, reqprot = prot; 901 unsigned long charged = 0, reqprot = prot;
902 902
903 if (file) {
904 if (is_file_hugepages(file))
905 accountable = 0;
906
907 if (!file->f_op || !file->f_op->mmap)
908 return -ENODEV;
909
910 if ((prot & PROT_EXEC) &&
911 (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
912 return -EPERM;
913 }
914 /* 903 /*
915 * Does the application expect PROT_READ to imply PROT_EXEC? 904 * Does the application expect PROT_READ to imply PROT_EXEC?
916 * 905 *
@@ -1000,6 +989,16 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
1000 case MAP_PRIVATE: 989 case MAP_PRIVATE:
1001 if (!(file->f_mode & FMODE_READ)) 990 if (!(file->f_mode & FMODE_READ))
1002 return -EACCES; 991 return -EACCES;
992 if (file->f_vfsmnt->mnt_flags & MNT_NOEXEC) {
993 if (vm_flags & VM_EXEC)
994 return -EPERM;
995 vm_flags &= ~VM_MAYEXEC;
996 }
997 if (is_file_hugepages(file))
998 accountable = 0;
999
1000 if (!file->f_op || !file->f_op->mmap)
1001 return -ENODEV;
1003 break; 1002 break;
1004 1003
1005 default: 1004 default:
@@ -1380,7 +1379,7 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
1380 * Check if the given range is hugepage aligned, and 1379 * Check if the given range is hugepage aligned, and
1381 * can be made suitable for hugepages. 1380 * can be made suitable for hugepages.
1382 */ 1381 */
1383 ret = prepare_hugepage_range(addr, len); 1382 ret = prepare_hugepage_range(addr, len, pgoff);
1384 } else { 1383 } else {
1385 /* 1384 /*
1386 * Ensure that a normal request is not falling in a 1385 * Ensure that a normal request is not falling in a
@@ -1881,6 +1880,9 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
1881 if ((addr + len) > TASK_SIZE || (addr + len) < addr) 1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr)
1882 return -EINVAL; 1881 return -EINVAL;
1883 1882
1883 if (is_hugepage_only_range(mm, addr, len))
1884 return -EINVAL;
1885
1884 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 1886 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
1885 1887
1886 error = arch_mmap_check(addr, len, flags); 1888 error = arch_mmap_check(addr, len, flags);