mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
f2fs: fix to check atomic_file in f2fs ioctl interfaces
commit bfe5c02654261bfb8bd9cb174a67f3279ea99e58 upstream. Some f2fs ioctl interfaces like f2fs_ioc_set_pin_file(), f2fs_move_file_range(), and f2fs_defragment_range() missed to check atomic_write status, which may cause potential race issue, fix it. Cc: stable@vger.kernel.org Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5e0de753bf
commit
7cb51731f2
@@ -2673,7 +2673,8 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
|
||||
|
||||
inode_lock(inode);
|
||||
|
||||
if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
|
||||
if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED) ||
|
||||
f2fs_is_atomic_file(inode)) {
|
||||
err = -EINVAL;
|
||||
goto unlock_out;
|
||||
}
|
||||
@@ -2904,6 +2905,11 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (f2fs_is_atomic_file(src) || f2fs_is_atomic_file(dst)) {
|
||||
ret = -EINVAL;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
ret = -EINVAL;
|
||||
if (pos_in + len > src->i_size || pos_in + len < pos_in)
|
||||
goto out_unlock;
|
||||
@@ -3288,6 +3294,11 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
|
||||
|
||||
inode_lock(inode);
|
||||
|
||||
if (f2fs_is_atomic_file(inode)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!pin) {
|
||||
clear_inode_flag(inode, FI_PIN_FILE);
|
||||
f2fs_i_gc_failures_write(inode, 0);
|
||||
|
||||
Reference in New Issue
Block a user