From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF61C432C3 for ; Tue, 19 Nov 2019 05:21:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 474D622319 for ; Tue, 19 Nov 2019 05:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574140879; bh=r/YU+KvIf+z6ar+xyhrZTY2mGiQKU1TxAIcyDr3xEyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nmW7rRExx0fRhtVol0ZeRpZZ6LQitKpQAVyU626JMLdb+a4arh6opMJHB8qt67b6X MH/U8MD9sQ5ogCJ7yVgoIX/XDGVt0v1x0fpLl+SDNvelQXHkCzd9nUG4zHfm2Wyo2Y P6OmzfAugRCLItz1LK5Z+1JPCoOw2bCvg/FCrg34= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbfKSFVS (ORCPT ); Tue, 19 Nov 2019 00:21:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:36050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbfKSFVQ (ORCPT ); Tue, 19 Nov 2019 00:21:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 709DB22319; Tue, 19 Nov 2019 05:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574140875; bh=r/YU+KvIf+z6ar+xyhrZTY2mGiQKU1TxAIcyDr3xEyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRV5By28tBUUjMraWxWUN6MNK5BCxrnN6nN0TVn08Bx+eVvx/Hhk8fV0kOa9K+8tR bUYnuDRFsun1eorWojAIpB7vlhej1zLN486cwiJtu0iVsTQm8IJTkKQDvIuyvQZsij cNhOEXHdy+YseeCdBY3T1eH9CA386tmJMVwEFatA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.3 17/48] ALSA: usb-audio: Fix incorrect size check for processing/extension units Date: Tue, 19 Nov 2019 06:19:37 +0100 Message-Id: <20191119051001.355520623@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119050946.745015350@linuxfoundation.org> References: <20191119050946.745015350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 976a68f06b2ea49e2ab67a5f84919a8b105db8be upstream. The recently introduced unit descriptor validation had some bug for processing and extension units, it counts a bControlSize byte twice so it expected a bigger size than it should have been. This seems resulting in a probe error on a few devices. Fix the calculation for proper checks of PU and EU. Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units") Cc: Link: https://lore.kernel.org/r/20191114165613.7422-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/validate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/usb/validate.c +++ b/sound/usb/validate.c @@ -81,9 +81,9 @@ static bool validate_processing_unit(con switch (v->protocol) { case UAC_VERSION_1: default: - /* bNrChannels, wChannelConfig, iChannelNames, bControlSize */ - len += 1 + 2 + 1 + 1; - if (d->bLength < len) /* bControlSize */ + /* bNrChannels, wChannelConfig, iChannelNames */ + len += 1 + 2 + 1; + if (d->bLength < len + 1) /* bControlSize */ return false; m = hdr[len]; len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */