提交 1941d7bc 编写于 作者: S Sheng Yong 提交者: Jaegeuk Kim

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: NSheng Yong <shengyong1@huawei.com>
Reviewed-by: NChao Yu <yuchao0@huawei.com>
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 b0beab50
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册