summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2016-08-04 15:13:02 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2016-08-19 05:15:08 +0300
commitfe8494bfc8c2914fca821d4ae994aef039be5cf1 (patch)
treebf6cc1e8b006c05c68c8378f296581978ed5322d /fs/f2fs/file.c
parent3024c9a1fefb3ac0d1b0b078a2e3f2f69478daab (diff)
downloadlinux-fe8494bfc8c2914fca821d4ae994aef039be5cf1.tar.xz
f2fs: allow copying file range only in between regular files
Only if two input files are regular files, we allow copying data in range of them, otherwise, deny it. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 0e493f63ea41..685e629f768b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2086,8 +2086,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
if (unlikely(f2fs_readonly(src->i_sb)))
return -EROFS;
- if (S_ISDIR(src->i_mode) || S_ISDIR(dst->i_mode))
- return -EISDIR;
+ if (!S_ISREG(src->i_mode) || !S_ISREG(dst->i_mode))
+ return -EINVAL;
if (f2fs_encrypted_inode(src) || f2fs_encrypted_inode(dst))
return -EOPNOTSUPP;