From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:46561 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbcHNUpI (ORCPT ); Sun, 14 Aug 2016 16:45:08 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Bauer , Linus Torvalds Subject: [PATCH 4.7 02/41] vfs: ioctl: prevent double-fetch in dedupe ioctl Date: Sun, 14 Aug 2016 22:38:28 +0200 Message-Id: <20160814202532.286350116@linuxfoundation.org> In-Reply-To: <20160814202531.818402015@linuxfoundation.org> References: <20160814202531.818402015@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: stable-owner@vger.kernel.org List-ID: 4.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Scott Bauer commit 10eec60ce79187686e052092e5383c99b4420a20 upstream. 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 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/ioctl.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -590,6 +590,7 @@ static long ioctl_file_dedupe_range(stru goto out; } + same->dest_count = count; ret = vfs_dedupe_file_range(file, same); if (ret) goto out;