]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix to check compress file in f2fs_move_file_range()
authorChao Yu <chao@kernel.org>
Sun, 10 Dec 2023 11:35:44 +0000 (19:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:43 +0000 (14:52 -0800)
[ Upstream commit fb9b65340c818875ea86464faf3c744bdce0055c ]

f2fs_move_file_range() doesn't support migrating compressed cluster
data, let's add the missing check condition and return -EOPNOTSUPP
for the case until we support it.

Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/file.c

index 58fd32db025daad73e707189dfa90b0b9df95038..0669ac4c0f12b00e220396da5795e222687dad88 100644 (file)
@@ -2780,6 +2780,11 @@ 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)) {
+               ret = -EOPNOTSUPP;
+               goto out_unlock;
+       }
+
        ret = -EINVAL;
        if (pos_in + len > src->i_size || pos_in + len < pos_in)
                goto out_unlock;