From patchwork Thu Aug 16 10:08:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10567283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50697139B for ; Thu, 16 Aug 2018 10:08:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4732A7E8 for ; Thu, 16 Aug 2018 10:08:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F8762A7EE; Thu, 16 Aug 2018 10:08:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A696D2A7E8 for ; Thu, 16 Aug 2018 10:08:14 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7D1B726781A; Thu, 16 Aug 2018 12:08:13 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id AC49D26781A; Thu, 16 Aug 2018 12:08:10 +0200 (CEST) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by alsa0.perex.cz (Postfix) with ESMTP id 7C53D26781E for ; Thu, 16 Aug 2018 12:08:07 +0200 (CEST) Received: from localhost (unknown [37.170.164.166]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AC8D240B; Thu, 16 Aug 2018 10:08:05 +0000 (UTC) To: alsa-devel@alsa-project.org, erickreyes@google.com, gregkh@linuxfoundation.org, joe@perches.com, kernel-team@android.com, perex@perex.cz, siqilin@google.com, tiwai@suse.com, viro@zeniv.linux.org.uk, vkoul@kernel.org From: Date: Thu, 16 Aug 2018 12:08:01 +0200 In-Reply-To: <20180816005548.151269-1-erickreyes@google.com> Message-ID: <153441408119339@kroah.com> MIME-Version: 1.0 X-stable: commit Cc: stable-commits@vger.kernel.org Subject: [alsa-devel] Patch "ALSA: info: Check for integer overflow in snd_info_entry_write()" has been added to the 3.18-stable tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This is a note to let you know that I've just added the patch titled ALSA: info: Check for integer overflow in snd_info_entry_write() to the 3.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: alsa-info-check-for-integer-overflow-in-snd_info_entry_write.patch and it can be found in the queue-3.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From erickreyes@google.com Thu Aug 16 12:07:22 2018 From: Erick Reyes Date: Wed, 15 Aug 2018 17:55:48 -0700 Subject: ALSA: info: Check for integer overflow in snd_info_entry_write() To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , kernel-team@android.com, Vinod Koul , Joe Perches , Al Viro , alsa-devel@alsa-project.org, Erick Reyes , Siqi Lin Message-ID: <20180816005548.151269-1-erickreyes@google.com> From: Erick Reyes Commit 4adb7bcbcb69 ("ALSA: core: Use seq_file for text proc file reads") heavily refactored ALSA procfs and fixed the overflow as a side-effect, so this fix only applies to kernels < 4.2 and there is no upstream equivalent snd_info_entry_write() resizes the buffer with an unsigned long size argument that gets truncated because resize_info_buffer() takes the size parameter as an unsigned int. On 64-bit kernels, this causes the following copy_to_user() to write out-of-bounds if (pos + count) can't be represented by an unsigned int. Signed-off-by: Siqi Lin Signed-off-by: Erick Reyes Signed-off-by: Greg Kroah-Hartman --- sound/core/info.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Patches currently in stable-queue which might be from erickreyes@google.com are queue-3.18/alsa-info-check-for-integer-overflow-in-snd_info_entry_write.patch --- a/sound/core/info.c +++ b/sound/core/info.c @@ -253,6 +253,7 @@ static ssize_t snd_info_entry_write(stru struct snd_info_buffer *buf; ssize_t size = 0; loff_t pos; + unsigned long realloc_size; data = file->private_data; if (snd_BUG_ON(!data)) @@ -261,7 +262,8 @@ static ssize_t snd_info_entry_write(stru pos = *offset; if (pos < 0 || (long) pos != pos || (ssize_t) count < 0) return -EIO; - if ((unsigned long) pos + (unsigned long) count < (unsigned long) pos) + realloc_size = (unsigned long) pos + (unsigned long) count; + if (realloc_size < (unsigned long) pos || realloc_size > UINT_MAX) return -EIO; switch (entry->content) { case SNDRV_INFO_CONTENT_TEXT: