summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2018-07-06 23:57:02 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2018-07-06 23:57:02 +0200
commit92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690 (patch)
tree2944ca30889746487f968de9d7867f953b6839a3
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
downloadop-kernel-dev-92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690.zip
op-kernel-dev-92b66d2cdd7a4f6f6aa31be5f16a3f0c88902690.tar.gz
vfs: limit size of dedupe
Suggested-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-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 153f8f6..f43bb12 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;
OpenPOWER on IntegriCloud