diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-06 23:57:02 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-06 23:57:02 +0200 |
commit | 92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690 (patch) | |
tree | 2944ca30889746487f968de9d7867f953b6839a3 /fs/read_write.c | |
parent | ce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff) |
vfs: limit size of dedupe
Suggested-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 153f8f690490..f43bb12b4759 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2003,6 +2003,9 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) if (off + len > i_size_read(src)) return -EINVAL; + /* Arbitrary 1G limit on a single dedupe request, can be raised. */ + len = min_t(u64, len, 1 << 30); + /* pre-format output fields to sane values */ for (i = 0; i < count; i++) { same->info[i].bytes_deduped = 0ULL; |