summaryrefslogtreecommitdiff
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2018-07-07 00:57:02 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2018-07-07 00:57:02 +0300
commit92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690 (patch)
tree2944ca30889746487f968de9d7867f953b6839a3 /fs/read_write.c
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
downloadlinux-92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690.tar.xz
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.c3
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;