1
0
Fork 0

f2fs: check range before defragment

This patch checks the parameter range passed by ioctl to void that range
exceeds the max_file_blocks limit.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
zero-colors
Sheng Yong 2017-03-08 10:47:12 +08:00 committed by Jaegeuk Kim
parent b0beab5016
commit 1941d7bcb4
1 changed files with 6 additions and 0 deletions

View File

@ -2054,6 +2054,12 @@ static int f2fs_ioc_defragment(struct file *filp, unsigned long arg)
goto out;
}
if (unlikely((range.start + range.len) >> PAGE_SHIFT >
sbi->max_file_blocks)) {
err = -EINVAL;
goto out;
}
err = f2fs_defragment_range(sbi, filp, &range);
f2fs_update_time(sbi, REQ_TIME);
if (err < 0)