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>
This commit is contained in:
Chao Yu 2016-08-04 20:13:02 +08:00 committed by Jaegeuk Kim
parent 3024c9a1fe
commit fe8494bfc8
1 changed files with 2 additions and 2 deletions

View File

@ -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;