Received: by 10.223.185.116 with SMTP id b49csp1895342wrg; Mon, 12 Feb 2018 00:12:09 -0800 (PST) X-Google-Smtp-Source: AH8x224be8dg2bH4jsrkFLrCkL1pjQNWj8WFjIR0F+4pLWjadSY2Pf6kqUbTLcK3zFUVxeH9IfOX X-Received: by 10.98.252.141 with SMTP id e135mr10889272pfh.159.1518423129488; Mon, 12 Feb 2018 00:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518423129; cv=none; d=google.com; s=arc-20160816; b=BaJh/YXglmZLdSq8KQvJYbGrt32uwp2aUmYc8RQsafcwVmjIl5MHlpyva/p7Z6z+Wk +pFIB4sZywC/TNe0WVV0y/R3Gpbk/CWsVQk3NtYefDn2VdpuwnVSXTOw1JoIPQxrK+UN kYzi3UD9bhS2f3kC+L8cWpZbulcdRXohIVbPWiAxA2DPbU9/tupAIkWls5WD6Jvz6ScP YB1RTzcv3ID2EYO4KHm3uLayZ2JuFAclvqfzlCsTRNpbBcObDF5Q6AptqARHZUIMwe3y j/Gm0Ijb8hpN9fgW6RH2RHR5lo9Ko6KzBEnnwhKvBPfUQmJgCwF0x4VOewSJpGCMkyB3 l6Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=m3iFDFxhJPIqDibPke50CzyvL1ZPqPtYSPj4jk4jUSU=; b=QkV1SBMdCr15Fy4Os2GfSvVt4vwfp7kib64LAlpXGdECfMPnnfAxq1RgPzA5RbbMar GSeKdIgyT8RkP90e0JNycqddKvyrS4QkuJtZpQG1Q8KLxlPtMRsdfoaqH5h6yaE5cBZk sUt5yfXCoXHZ9DJadlkboqNIFXqMi/IAIWbbH/win/a/SRwLep9OU1Us98ncu4Y2ZYFK JxL0rYH3gM0oEfTWodfP6apebgXCf8EvluyXW6n5E5dDaEgdqEJcCXz1jwnw5A1eLRd4 gdN7pTrb3UBGZkasxIl9kyFPQxkhuIWDpLpYBhZ7KBg3Fs5RaG7F3rJJUL/Bmu4OLilM ZByA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u185si3314920pgc.453.2018.02.12.00.11.55; Mon, 12 Feb 2018 00:12:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753849AbeBLG7y (ORCPT + 99 others); Mon, 12 Feb 2018 01:59:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:57690 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753808AbeBLG7x (ORCPT ); Mon, 12 Feb 2018 01:59:53 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9A77FAAC5; Mon, 12 Feb 2018 06:59:51 +0000 (UTC) Date: Mon, 12 Feb 2018 07:59:51 +0100 Message-ID: From: Takashi Iwai To: Ben Hutchings Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [PATCH 3.2 57/79] ALSA: usb-audio: Fix potential zero-division at parsing FU In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 11 Feb 2018 05:20:06 +0100, Ben Hutchings wrote: > > 3.2.99-rc1 review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Takashi Iwai > > commit 8428a8ebde2db1e988e41a58497a28beb7ce1705 upstream. Please drop this. This patch is broken, and was reverted in the later commit 3c02a6d94665. thanks, Takashi > > parse_audio_feature_unit() contains a code dividing potentially with > zero when a malformed FU descriptor is passed. Although there is > already a sanity check, it checks only the value zero, hence it can > still lead to a zero-division when a value 1 is passed there. > > Fix it by correcting the sanity check (and the error message > thereof). > > Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0") > Signed-off-by: Takashi Iwai > [bwh: Backported to 3.2: adjust context] > Signed-off-by: Ben Hutchings > --- > sound/usb/mixer.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- a/sound/usb/mixer.c > +++ b/sound/usb/mixer.c > @@ -1262,9 +1262,9 @@ static int parse_audio_feature_unit(stru > return -EINVAL; > } > csize = hdr->bControlSize; > - if (!csize) { > + if (csize <= 1) { > snd_printdd(KERN_ERR "usbaudio: unit %u: " > - "invalid bControlSize == 0\n", unitid); > + "invalid bControlSize <= 1\n", unitid); > return -EINVAL; > } > channels = (hdr->bLength - 7) / csize - 1; >