Commit fe8494bf authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 3024c9a1
...@@ -2086,8 +2086,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, ...@@ -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))) if (unlikely(f2fs_readonly(src->i_sb)))
return -EROFS; return -EROFS;
if (S_ISDIR(src->i_mode) || S_ISDIR(dst->i_mode)) if (!S_ISREG(src->i_mode) || !S_ISREG(dst->i_mode))
return -EISDIR; return -EINVAL;
if (f2fs_encrypted_inode(src) || f2fs_encrypted_inode(dst)) if (f2fs_encrypted_inode(src) || f2fs_encrypted_inode(dst))
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment