diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c index a81319b6177f..4b6096014c9c 100644 --- a/fs/open.c +++ b/fs/open.c @@ -277,6 +277,11 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) (mode & ~(FALLOC_FL_UNSHARE_RANGE | FALLOC_FL_KEEP_SIZE))) return -EINVAL; + /* Mapping free space should only be used by itself. */ + if ((mode & FALLOC_FL_MAP_FREE_SPACE) && + (mode & ~FALLOC_FL_MAP_FREE_SPACE)) + return -EINVAL; + if (!(file->f_mode & FMODE_WRITE)) return -EBADF; |