Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chao Yu and committed by
Jaegeuk Kim
fe8494bf 3024c9a1

+2 -2
+2 -2
fs/f2fs/file.c
··· 2086 2086 if (unlikely(f2fs_readonly(src->i_sb))) 2087 2087 return -EROFS; 2088 2088 2089 - if (S_ISDIR(src->i_mode) || S_ISDIR(dst->i_mode)) 2090 - return -EISDIR; 2089 + if (!S_ISREG(src->i_mode) || !S_ISREG(dst->i_mode)) 2090 + return -EINVAL; 2091 2091 2092 2092 if (f2fs_encrypted_inode(src) || f2fs_encrypted_inode(dst)) 2093 2093 return -EOPNOTSUPP;