Received: by 10.223.185.116 with SMTP id b49csp821795wrg; Sat, 10 Feb 2018 21:11:17 -0800 (PST) X-Google-Smtp-Source: AH8x224acv2v6GlmROGGjM+3PLg2HGp8pdVPDgoMpoiuzjUR7URfakV0Yq2Z0zLLXId3CCIiVx4y X-Received: by 10.99.112.73 with SMTP id a9mr6318905pgn.126.1518325877192; Sat, 10 Feb 2018 21:11:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518325877; cv=none; d=google.com; s=arc-20160816; b=KpmahTySlG+DB0MEF7SrkkN0QeNMb24cE0OH+jX1RY0wQMVGKShYYDmbUcoYdrVQAV 312PMMFCJZuUGWtURDt947DvUMIsqlTf69Fr4bycUVSywqeRGuS9lJOdD2M6AH+X0dNf cALXoQerJHHv1WSvmEV9Smu+G5qEmLKmwL1BEpS8ON/L2TOLpVxsnDtfEyCETNtnGd8B vV9yj4AXtcXKKOlC/xVRrjBjXVUobGuT8uVOwSbY4pfDF4hpUf/XxFyx8dVqhZTch6sG hWj3SsySVtLnRUv2/vfWuvf8Y0UPMSJ1/zoBrdJwu95IlZJYRz+2p9FRZqAa4JtXvEQJ L61A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=ZdKncuDQGb3WIojt5ZbLu1M9fUMifd7oBeTtURJ9tw0=; b=o6SkrBEtlosQoAJVk3S3zHWmO1QGLUNMf9guDCDpXHrRUJmuaHYVy9FghAt6zb/ssm IEUVZLWvdI0C2iKXwG94/wtmk6F8GGBNNjw/9Q/lCOmok9sQHtGItl4KvTalcczKcR6T thftgXGhyHqjvIzG9EOfY2wH+15fQFH81eQjqFvCGbl8/9DBtDs1Hik+4T//NmpXX2W4 KmgF42K0TMA5MS+4jtwfuCiTOhJz5MGkzIYhT2NRALoARj5o9dMLaeEGo477Sqfl3WYU 5i6q+ysCK0rUP1iBtsJ71MmJzIRFby1/DH3jMeycxAdlcJoCrcyXD3QKkO9x/1z3IILP lsJQ== 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 g31-v6si3333208pld.714.2018.02.10.21.11.03; Sat, 10 Feb 2018 21:11:17 -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 S932067AbeBKFK1 (ORCPT + 99 others); Sun, 11 Feb 2018 00:10:27 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41433 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752644AbeBKEdm (ORCPT ); Sat, 10 Feb 2018 23:33:42 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ekjKd-0002hJ-Rb; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKY-0004W1-H9; Sun, 11 Feb 2018 04:33:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Takashi Iwai" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 57/79] ALSA: usb-audio: Fix potential zero-division at parsing FU In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 8428a8ebde2db1e988e41a58497a28beb7ce1705 upstream. 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;