From: Chao Yu Date: Wed, 3 Apr 2024 14:24:20 +0000 (+0800) Subject: f2fs: fix to check pinfile flag in f2fs_move_file_range() X-Git-Tag: v5.15.161~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=919f899a22075c9233157ccfcca1b5bbd9b02600;p=thirdparty%2Fkernel%2Fstable.git f2fs: fix to check pinfile flag in f2fs_move_file_range() [ Upstream commit e07230da0500e0919a765037c5e81583b519be2c ] ioctl(F2FS_IOC_MOVE_RANGE) can truncate or punch hole on pinned file, fix to disallow it. Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 39002f3c3f8a7..f10156aecf425 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2790,7 +2790,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, goto out; } - if (f2fs_compressed_file(src) || f2fs_compressed_file(dst)) { + if (f2fs_compressed_file(src) || f2fs_compressed_file(dst) || + f2fs_is_pinned_file(src) || f2fs_is_pinned_file(dst)) { ret = -EOPNOTSUPP; goto out_unlock; }