|
@@ -919,6 +919,10 @@ static int validate_mmap_request(struct file *file,
|
|
if (!file->f_op->read)
|
|
if (!file->f_op->read)
|
|
capabilities &= ~BDI_CAP_MAP_COPY;
|
|
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) {
|
|
if (flags & MAP_SHARED) {
|
|
/* do checks for writing, appending and locking */
|
|
/* do checks for writing, appending and locking */
|
|
if ((prot & PROT_WRITE) &&
|
|
if ((prot & PROT_WRITE) &&
|