Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5258094imu; Tue, 15 Jan 2019 14:14:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN77c2TNx/nWvUM7Hj1uZRJ7tqAyGJq3CHqaCAjpvnTWckNWykbAlHBqwVweX6anp1PziR4T X-Received: by 2002:a17:902:d70b:: with SMTP id w11mr6467286ply.294.1547590461378; Tue, 15 Jan 2019 14:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590461; cv=none; d=google.com; s=arc-20160816; b=OSKmmt0NqDltKaQQluFLsyN7kJT5X9u5Uvhq+nhs0eb1k+4zJYUahLp/WnCcp345wU 3ssAHV26UVVZhFXBlvD/zZ+aA90YxYe0EFefpXfdhgQiQtC0tNaKHJj8aDGelhPoQwf7 0CiDTs3FShWegvwroZdpGIlZN/yIfH3WiFsx1YFwUbb3JL7KMqpC4ka+DJn+7pPcKRtY YBfhV7mHYDd5bL8lfGGqL9Z8a4PM2thrDVqqgIXf+Tk+wfoTYbOB6pLu81atc3QqWy7e Srucw2f8rwUNYjTTV4/XIiodjUFldOSfVpijYtjYCfB8yT/apWDBhff8d6yM/ICq/zXE BR8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OmfvM0vggxAZnZ544I0M/GB+lzUEr635mKTjWMpt8eQ=; b=MPAU/1LlZFpNmZ3OqEnRSxCNjKhtcwBZofgbjQiA6WLQgjJDvQ0+BBFqVs7rYJpiOS qUVLRtMQbIt/XQXbxWY4W04HvW9/LDiYqJtNpunTjKTCmZSL/V3eSA6YUdZN1uhErzTv o31AuTCqXLZPsxXso4XQMQrdY0KqlGSkSTanCSY7aXyZTuVKkOXXvIM+OARpD0R3ghOq 7P3Js3cLLB93vPFdv6ae+7CaM6TmSTUTUKHKUXTLMqGE0zpDl151QSOLBx9wo1vMRJ7l /NoinbIc4KA+S5e+8FzdW3IhN/Ee+b6IVzjwgi4v3kMtZimcBY8CHEm6n5NVoMRvBi1Y O6bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ut5zjPp7; 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 f21si4050016pgv.111.2019.01.15.14.14.01; Tue, 15 Jan 2019 14:14:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Ut5zjPp7; 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 S2388036AbfAOQyB (ORCPT + 99 others); Tue, 15 Jan 2019 11:54:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388025AbfAOQx7 (ORCPT ); Tue, 15 Jan 2019 11:53:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 E4DE120657; Tue, 15 Jan 2019 16:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547571238; bh=jnYErAN+63vh7i9QlfZ4O+HWC/qDlb0XxZToPNgolW8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ut5zjPp7w0E5nGmZJ4ffC3RU0zqDUh5u3samocPJ3zrIIhzV+p55Xe3F39s+oXjey EO/pGs4G88SmBEnZBihDV6Zwqll/uiPDoWNKQTuLgeSbanS2Ilc3c/y6H2gNqB9DIN vwKSdHG7tDIncQU1kT0gbQLeAsB3zNg97pYzwkpw= Date: Tue, 15 Jan 2019 17:40:16 +0100 From: Greg Kroah-Hartman To: Nikolay Yakimov Cc: Saranya Gopal , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: Fix configuration selection issues introduced in v4.20.0 Message-ID: <20190115164016.GA25341@kroah.com> References: <20190115161354.6806-1-root@livid.pp.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115161354.6806-1-root@livid.pp.ru> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 15, 2019 at 07:13:54PM +0300, Nikolay Yakimov wrote: > Commit f13912d3f014a introduced changes to the usb_choose_configuration function > to better support USB Audio UAC3-compatible devices. However, there are a few > problems with this patch. First of all, it adds new "if" clauses in the middle > of an existing "if"/"else if" tree, which obviously breaks pre-existing logic. > Secondly, since it continues iterating over configurations in one of the branches, > other code in the loop can choose an unintended configuration. Finally, > if an audio device's first configuration is UAC3-compatible, and there > are multiple UAC3 configurations, the second one would be chosen, due to > the first configuration never being checked for UAC3-compatibility. > > Commit ff2a8c532c14 tries to fix the second issue, but it goes about it in a > somewhat unnecessarily convoluted way, in my opinion, and does nothing > to fix the first or the last one. > > This patch tries to rectify problems described by essentially rewriting > code introduced in f13912d3f014a. Notice the code was moved to *before* > the "if"/"else if" tree. > > Signed-off-by: Nikolay Yakimov > --- > drivers/usb/core/generic.c | 44 ++++++++++++++++++++++---------------- > 1 file changed, 25 insertions(+), 19 deletions(-) Were you able to test this on one of the devices that ff2a8c532c14 ("usbcore: Select only first configuration for non-UAC3 compliant devices") was created to fix? thanks, greg k-h