aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 28754c40be98..4bde489ec431 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -919,6 +919,10 @@ static int validate_mmap_request(struct file *file,
919 if (!file->f_op->read) 919 if (!file->f_op->read)
920 capabilities &= ~BDI_CAP_MAP_COPY; 920 capabilities &= ~BDI_CAP_MAP_COPY;
921 921
922 /* The file shall have been opened with read permission. */
923 if (!(file->f_mode & FMODE_READ))
924 return -EACCES;
925
922 if (flags & MAP_SHARED) { 926 if (flags & MAP_SHARED) {
923 /* do checks for writing, appending and locking */ 927 /* do checks for writing, appending and locking */
924 if ((prot & PROT_WRITE) && 928 if ((prot & PROT_WRITE) &&