patch-2.4.25 linux-2.4.25/mm/mmap.c
Next file: linux-2.4.25/mm/mremap.c
Previous file: linux-2.4.25/mm/filemap.c
Back to the patch index
Back to the overall index
-  Lines: 24
-  Date:
2004-02-18 05:36:32.000000000 -0800
-  Orig file: 
linux-2.4.24/mm/mmap.c
-  Orig date: 
2003-11-28 10:26:21.000000000 -0800
diff -urN linux-2.4.24/mm/mmap.c linux-2.4.25/mm/mmap.c
@@ -14,6 +14,7 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/personality.h>
+#include <linux/mount.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -400,8 +401,13 @@
 	int error;
 	rb_node_t ** rb_link, * rb_parent;
 
-	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 (!len)
 		return addr;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)