summaryrefslogtreecommitdiffstats
path: root/fs/ioctl.c
diff options
context:
space:
mode:
authorScott Bauer2016-07-28 03:11:29 +0200
committerLinus Torvalds2016-07-29 00:23:12 +0200
commit10eec60ce79187686e052092e5383c99b4420a20 (patch)
tree27093bca5e5208aa8e8e04e28b3cc5df4ecbf0af /fs/ioctl.c
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jik... (diff)
downloadkernel-qcow2-linux-10eec60ce79187686e052092e5383c99b4420a20.tar.gz
kernel-qcow2-linux-10eec60ce79187686e052092e5383c99b4420a20.tar.xz
kernel-qcow2-linux-10eec60ce79187686e052092e5383c99b4420a20.zip
vfs: ioctl: prevent double-fetch in dedupe ioctl
This prevents a double-fetch from user space that can lead to to an undersized allocation and heap overflow. Fixes: 54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs") Signed-off-by: Scott Bauer <sbauer@plzdonthack.me> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ioctl.c')
-rw-r--r--fs/ioctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 116a333e9c77..0f56deb24ce6 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -590,6 +590,7 @@ static long ioctl_file_dedupe_range(struct file *file, void __user *arg)
goto out;
}
+ same->dest_count = count;
ret = vfs_dedupe_file_range(file, same);
if (ret)
goto out;