Skip to content

Commit

Permalink
vfs: ioctl: prevent double-fetch in dedupe ioctl
Browse files Browse the repository at this point in the history
commit 10eec60 upstream.

This prevents a double-fetch from user space that can lead to to an
undersized allocation and heap overflow.

Fixes: 54dbc15 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Scott Bauer authored and Greg Kroah-Hartman committed Aug 10, 2016
1 parent 900ac92 commit 04678f5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 04678f5

Please sign in to comment.