aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d7214fbfc..c5dbe9ff8 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2086,6 +2086,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)