diff --git a/[refs] b/[refs] index 933341a91a94..8bc90f34585e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 191529756633052680dd9d23ad63744ca5aa02a1 +refs/heads/master: 28d7a6ae92c099d81cbea08c20be0d2cf7ccd7ca diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index 28754c40be98..4bde489ec431 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -919,6 +919,10 @@ static int validate_mmap_request(struct file *file, if (!file->f_op->read) capabilities &= ~BDI_CAP_MAP_COPY; + /* The file shall have been opened with read permission. */ + if (!(file->f_mode & FMODE_READ)) + return -EACCES; + if (flags & MAP_SHARED) { /* do checks for writing, appending and locking */ if ((prot & PROT_WRITE) &&