Message ID | 1669193290-24263-1-git-send-email-quic_prashk@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2669528wrr; Wed, 23 Nov 2022 00:50:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4DuV/3XWJEKEHQNGrtBGFcF15RqQHAYmJjNt2ozDSkod9IGVKN1yQ2qRHflXj7aJ8WQwI4 X-Received: by 2002:a05:6402:1f14:b0:461:c7ef:b09e with SMTP id b20-20020a0564021f1400b00461c7efb09emr11193904edb.58.1669193452935; Wed, 23 Nov 2022 00:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669193452; cv=none; d=google.com; s=arc-20160816; b=FPeXUmIP/fRrUETY2dknzEgwp5NDNtiFpH067dkME2SbbOhfC+c3ct50v55pu/94U1 w+rzae23J1EPeORaU9sBRMwlIl/Ki/3DGcIPTRAdAfYuzRZdhmBAXL6wHDMNcRsGPCan J6ecNZsDTD/IG6IVYRf/URCb+XYbNhUJL2v1hTwF8ZU8wWju8IXvwCxVZQmZGcgb7LjH pAYvcN+c1aR/mBZyNH5NvV6+LSBVCoBHOkGZWGNEea5L0DXRMfShI9g7s89nUIg/OZu1 7j8W0HgmSbzKFldG94mu0gpJ4dhEBDi+u107p3c736KJOmwLvIcLQq7fDCWVQpMMDZUK l18w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Pi8BiOP1Ato5hfmyoHvMzNY2xZfCye5vh2+Bl//5nhc=; b=PWOzUVUBXCNOLW6DYbdHVNUd5G7b4AIdadWVaWp2cD7KJJ2o7LFu+nhdGQt29HxRaU K7m+znn7JvvSfUEW9sRUoEq2RUamnGLh2nOjSQslClIukaRY4jkxnIyw7gmDeMraMZ2O uc/JZHgRAa7DmQMJ5MTR4TqN5rAdzBRAZ/9qqVyrk9qRMHfxIRkD2Ed7JH+kWw8uX6TL r0cfQyjSgqm21hZOPCkr0D6Wv4MC8+4mjmSWM0rLoGC0CEo+47FuDTH8BEadKGp8pxB8 r/o8ZPVsVhJHyz/fBxgy4RoCWCDQaFnSEyWf4DC2/lR1Nl3qKiRgb3jFsSGjyCHpScQD h2Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IK0ozcvP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji15-20020a170907980f00b007acbaeed9besi15537244ejc.398.2022.11.23.00.50.29; Wed, 23 Nov 2022 00:50:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IK0ozcvP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236552AbiKWIsr (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Wed, 23 Nov 2022 03:48:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236660AbiKWIs2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 23 Nov 2022 03:48:28 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69D553ECD; Wed, 23 Nov 2022 00:48:26 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AN8RrlV014933; Wed, 23 Nov 2022 08:48:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=Pi8BiOP1Ato5hfmyoHvMzNY2xZfCye5vh2+Bl//5nhc=; b=IK0ozcvPXdp9i3aYvdmFG62tXAY28ts0oYNeGGroD8Rw5EIbQOaeHiFxdd8C9ACa1Eoy QLrkzpB2YjzXywhVV+QtmtLyVpRXyJabpC9kxX5xAvY6I1gLJjFfNnTBhv9tizuDf52/ 5n1l8QqeM34YOecluHOHLiuB1YdBM15jMZejnZ4fEHygQ2J+RyDK8SgnFcLtWCzylljC 8jbJ6NAZQfn+ykHp0LdpIzhxd2k3jiSXl4oiTHBINaysyt2rikDsVRK4F34Dubnp2M+E NVUVTepiqzjUAktBHwU7eXIin1r8fGcLhVQlN5iGaWa34W3JEBXQk3fqnc0/PHht7g3x LA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m0twqawdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 08:48:18 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AN8mHZt003930 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 08:48:17 GMT Received: from hu-prashk-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 23 Nov 2022 00:48:14 -0800 From: Prashanth K <quic_prashk@quicinc.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Pavel Hofman <pavel.hofman@ivitera.com>, Joe Perches <joe@perches.com>, Julian Scheel <julian@jusst.de>, Colin Ian King <colin.i.king@gmail.com> CC: Pratham Pratap <quic_ppratap@quicinc.com>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Prashanth K <quic_prashk@quicinc.com> Subject: usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints Date: Wed, 23 Nov 2022 14:18:10 +0530 Message-ID: <1669193290-24263-1-git-send-email-quic_prashk@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 3PaFAXxbfqutTscV2xO-9y3rMBOCIfIR X-Proofpoint-ORIG-GUID: 3PaFAXxbfqutTscV2xO-9y3rMBOCIfIR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-23_04,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 lowpriorityscore=0 mlxlogscore=637 spamscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211230066 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750276194227605231?= X-GMAIL-MSGID: =?utf-8?q?1750276194227605231?= |
Series |
usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints
|
|
Commit Message
Prashanth K
Nov. 23, 2022, 8:48 a.m. UTC
Currently connect/disconnect of USB cable calls afunc_bind and eventually increments the bNumEndpoints. And performing multiple plugin/plugout will incorrectly increment bNumEndpoints on the next plug-in leading to invalid configuration of descriptor and hence enumeration failure. Fix this by resetting the value of bNumEndpoints to 1 on every afunc_bind call. Signed-off-by: Pratham Pratap <quic_ppratap@quicinc.com> Signed-off-by: Prashanth K <quic_prashk@quicinc.com> --- drivers/usb/gadget/function/f_uac2.c | 1 + 1 file changed, 1 insertion(+)
Comments
On Wed, Nov 23, 2022 at 02:18:10PM +0530, Prashanth K wrote: > Currently connect/disconnect of USB cable calls afunc_bind and > eventually increments the bNumEndpoints. And performing multiple > plugin/plugout will incorrectly increment bNumEndpoints on the > next plug-in leading to invalid configuration of descriptor and > hence enumeration failure. > > Fix this by resetting the value of bNumEndpoints to 1 on every > afunc_bind call. > > Signed-off-by: Pratham Pratap <quic_ppratap@quicinc.com> > Signed-off-by: Prashanth K <quic_prashk@quicinc.com> Who authored this, Pratham or you? And why no "[PATCH]" in the subject line? What commit id does this fix? thanks, greg k-h
On 23-12-22 08:26 pm, Greg Kroah-Hartman wrote: > On Wed, Nov 23, 2022 at 02:18:10PM +0530, Prashanth K wrote: >> Currently connect/disconnect of USB cable calls afunc_bind and >> eventually increments the bNumEndpoints. And performing multiple >> plugin/plugout will incorrectly increment bNumEndpoints on the >> next plug-in leading to invalid configuration of descriptor and >> hence enumeration failure. >> >> Fix this by resetting the value of bNumEndpoints to 1 on every >> afunc_bind call. >> >> Signed-off-by: Pratham Pratap <quic_ppratap@quicinc.com> >> Signed-off-by: Prashanth K <quic_prashk@quicinc.com> > > Who authored this, Pratham or you? > Its authored by Pratham, but I'm upstreaming it. > And why no "[PATCH]" in the subject line? > I was under the impression that [PATCH] is not used for v1. Will fix this in next patch > What commit id does this fix? > Will add the Fixes tag also in next patch > thanks, > > greg k-h Thanks Prashanth K
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 08726e4..0219cd7 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -1142,6 +1142,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) } std_as_out_if0_desc.bInterfaceNumber = ret; std_as_out_if1_desc.bInterfaceNumber = ret; + std_as_out_if1_desc.bNumEndpoints = 1; uac2->as_out_intf = ret; uac2->as_out_alt = 0;