diff options
author | Dan Robertson <dan@dlrobertson.com> | 2020-08-30 23:45:23 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-09-11 20:11:25 +0200 |
commit | aad1383cbf08c87f29f5dba1622e122717fbc32a (patch) | |
tree | 4301709a2b41087742d804eb86b030520cded895 /fs/f2fs/file.c | |
parent | f2fs: correct statistic of APP_DIRECT_IO/APP_DIRECT_READ_IO (diff) | |
download | linux-aad1383cbf08c87f29f5dba1622e122717fbc32a.tar.xz linux-aad1383cbf08c87f29f5dba1622e122717fbc32a.zip |
f2fs: check position in move range ioctl
When the move range ioctl is used, check the input and output position and
ensure that it is a non-negative value. Without this check
f2fs_get_dnode_of_data may hit a memmory bug.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | fs/f2fs/file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a7e15bec7a8e..0a958eef3d1f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2768,6 +2768,9 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, if (IS_ENCRYPTED(src) || IS_ENCRYPTED(dst)) return -EOPNOTSUPP; + if (pos_out < 0 || pos_in < 0) + return -EINVAL; + if (src == dst) { if (pos_in == pos_out) return 0; |