net/mlx4: Fix firmware command timeout during interrupt test
[cascardo/linux.git] / fs / open.c
index a7719cf..d3ed817 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -267,6 +267,11 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
            (mode & ~FALLOC_FL_INSERT_RANGE))
                return -EINVAL;
 
+       /* Unshare range should only be used with allocate mode. */
+       if ((mode & FALLOC_FL_UNSHARE_RANGE) &&
+           (mode & ~(FALLOC_FL_UNSHARE_RANGE | FALLOC_FL_KEEP_SIZE)))
+               return -EINVAL;
+
        if (!(file->f_mode & FMODE_WRITE))
                return -EBADF;