Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2634411pxa; Mon, 17 Aug 2020 15:02:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKCtOZZ3TKiiy0Nm6lSbDz/NRfsz+DUqMBQye2n+aZ5bUSDCs1nEnMtOANKxBV/AHIojfg X-Received: by 2002:a17:906:4007:: with SMTP id v7mr17619279ejj.197.1597701766403; Mon, 17 Aug 2020 15:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597701766; cv=none; d=google.com; s=arc-20160816; b=gZmFZdpxDro4Dr4di5uFV5jgRZRTFOZ9d9x4g/bvdtpcHTEJmC9v1WgPcPkiYVRDQQ FP7fzCQtoE5k3U8w7T59NM+YhsFCZ5i2XSv1lMdjal614igk5ghaI4oKVqijCQSxAhqd 6b8nYt9VHkdPy0KqbD6EHw/+Vkp0RxDTkO0ufNmS7AnEus0QTQbZZ4HPS3FwJtvbfcQN yH1qmA5uCEq+YUA2T0e+wRLBYp6sPBvyHIIkIFSxb7Wl/+d/pXL06oYJAEt6vdRqJvNA fzKE7TvaImoMpc0wCT08DkKg/1bzkwr0SgLibhKDkKRK9Bra0I+7HA4LFZdR9C/Oy4RG L7zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BAUmB1V6u2IfNg2u5LWLh66nnFf1TglYwi4j0Y292KU=; b=jP7XaHm3KQakRWg4mL08WcLuSC3Vmhe/nFQHEwDgTx4JMDWm4l6ALgxyluC4OmLeet zcXZxpl+wqRhSERINDWrTdmTa73jAbOEDcfgn/A9lpip27ZLRyb4q7OS0xkkrymXtv8x 33XDys7FC99BJA1D7lojwCUJZsDn9zpjjML29iylu9w1atcYupo7BnLppPO0IFvAsnAe IpTpGY9VM8G1iOx8zd0ABb+STF/md+g0L35m+jOlMdPbqTDc98t1s0LP8J7fg7SnTGJh l+OWVqvrneUayWCd1gk03GjlRVSOkW3F0Nfj2FPSfvIf8Q/cKeFnCTL2n7XRgvrwviIY Ferg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8rgrCvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si11964982edr.140.2020.08.17.15.02.21; Mon, 17 Aug 2020 15:02:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8rgrCvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387451AbgHQPjp (ORCPT + 99 others); Mon, 17 Aug 2020 11:39:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:34678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730356AbgHQPdK (ORCPT ); Mon, 17 Aug 2020 11:33:10 -0400 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 ABC8622D2B; Mon, 17 Aug 2020 15:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678389; bh=FUZwdoJcDyZhXonX3b0z2SZLVlmKS7j3/PGP0+6wo7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8rgrCvhaYo4V1W4KYrpvfv5ivBYnMB5juqJm0np+OgCpP/6QYs6pVo0v4lNjkBti ANOjbG2K67+1Ryr+2exv8HwvXqk9Kqzdu/edvn1K8aeexEjbO5LbI5nR+orCJwnJN+ y/iyZ7oAnDIC5sC0OsSgFs85CczAQURIMrCcucHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruslan Bilovol , Felipe Balbi , Sasha Levin Subject: [PATCH 5.8 287/464] usb: gadget: f_uac2: fix AC Interface Header Descriptor wTotalLength Date: Mon, 17 Aug 2020 17:14:00 +0200 Message-Id: <20200817143847.503525073@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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: Ruslan Bilovol [ Upstream commit a9cf8715180b18c62addbfe6f6267b8101903119 ] As per UAC2 spec (ch. 4.7.2), wTotalLength of AC Interface Header Descriptor "includes the combined length of this descriptor header and all Clock Source, Unit and Terminal descriptors." Thus add its size to its wTotalLength. Also after recent changes wTotalLength is calculated dynamically, update static definition of uac2_ac_header_descriptor accordingly Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver") Signed-off-by: Ruslan Bilovol Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uac2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index db2d4980cb354..3633df6d7610f 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -215,10 +215,7 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = { .bDescriptorSubtype = UAC_MS_HEADER, .bcdADC = cpu_to_le16(0x200), .bCategory = UAC2_FUNCTION_IO_BOX, - .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc - + sizeof out_clk_src_desc + sizeof usb_out_it_desc - + sizeof io_in_it_desc + sizeof usb_in_ot_desc - + sizeof io_out_ot_desc), + /* .wTotalLength = DYNAMIC */ .bmControls = 0, }; @@ -501,7 +498,7 @@ static void setup_descriptor(struct f_uac2_opts *opts) as_in_hdr_desc.bTerminalLink = usb_in_ot_desc.bTerminalID; iad_desc.bInterfaceCount = 1; - ac_hdr_desc.wTotalLength = 0; + ac_hdr_desc.wTotalLength = cpu_to_le16(sizeof(ac_hdr_desc)); if (EPIN_EN(opts)) { u16 len = le16_to_cpu(ac_hdr_desc.wTotalLength); -- 2.25.1