Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1952300rwd; Wed, 17 May 2023 03:52:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Z2+mxwaHU3swAvlooy7h5D/kzr3iazxr0G3MAja1Gh8BFwhyhoAN0+slRYt5EiRUc7f/9 X-Received: by 2002:a05:6a20:734c:b0:104:c3cf:1c53 with SMTP id v12-20020a056a20734c00b00104c3cf1c53mr21638594pzc.3.1684320761589; Wed, 17 May 2023 03:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684320761; cv=none; d=google.com; s=arc-20160816; b=xdS0Fouc67NKL42Z42IFMf0Nhpzb33EQ+NrMYWxxCzq9fwt7gaY4Tf8Vsx0UhbAiRr wmgYGczh9C2j/7Fh4NruMf47LrvReg5gpuRWlD6JpCfGzi01JhzeIHIWe7XiJH9ERbCV Lw4a6o7K21cJPnuZwjJosm8DU4XqT441iW0VxJGagvM5kMcVUkfI5LQRn9PMIe/cXwf1 lLHzhO/OGgpcfAu7mQgmAryKksMAnyj8cg8sRcG5JUrVc1rt9hpyuwLcnNBV2CT/9gqL jb4Ki0YM2bBIhuCGYxwG1eqNPAC77HB933TyM7IoZr1ycUImMJntXM7cfz89Jc+Gf40H vzIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:reply-to :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id; bh=adjb4TiGp9LSY1sONHxhIiTBuSC4/6KEufdvnvRoEQE=; b=JDQJPkM8hp3TlDEl3y+PLq2Iis6S0KSta7R3sCjLp95l/3qziWZTu/S9pyLjueJqQV v3E5Mio3Ty/vvALP2u5lxsqPzpSEQqLjDctveM0jsmjh8Vw0eVWpmDGCXIjxpQsNx1V0 l99QL7val6veKV8pw/QhdnDPjCTGRJuzUpUU2JiS8f2CoQpXT3YyR5YG+AJVBKbZCfpf kU7eu3U+jmW6TMa8NdSN2NYp2ahP6gaH4+Ga7P0KsPCPE5aQVLE0/38jYdlvUPmhLIcd Fum9zY4MzsF4nTPqMowzXV7nY9Z6OblJATKxA+jfose8qZPbR35oBZkyR5YAF7dZNKxp PKqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a63aa05000000b00528595a1390si20781381pgf.588.2023.05.17.03.52.29; Wed, 17 May 2023 03:52:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjEQKXx (ORCPT + 99 others); Wed, 17 May 2023 06:23:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjEQKXw (ORCPT ); Wed, 17 May 2023 06:23:52 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC823C33; Wed, 17 May 2023 03:23:50 -0700 (PDT) Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1pzEJp-00072y-2T; Wed, 17 May 2023 12:23:41 +0200 Message-ID: <1ac16f0a-3cca-40ca-c444-82719f85a24c@leemhuis.info> Date: Wed, 17 May 2023 12:23:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started To: Alistair , Badhri Jagan Sridharan , gregkh@linuxfoundation.org, stern@rowland.harvard.edu, colin.i.king@gmail.com, xuetao09@huawei.com, quic_eserrao@quicinc.com, water.zhangjiantao@huawei.com, peter.chen@freescale.com, balbi@ti.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Linux kernel regressions list , Francesco Dolcini References: <20230407030741.3163220-1-badhri@google.com> <0cf8c588b701d7cf25ffe1a9217b81716e6a5c51.camel@alistair23.me> Content-Language: en-US, de-DE From: "Linux regression tracking (Thorsten Leemhuis)" Reply-To: Linux regressions mailing list In-Reply-To: <0cf8c588b701d7cf25ffe1a9217b81716e6a5c51.camel@alistair23.me> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;regressions@leemhuis.info;1684319030;5427161a; X-HE-SMSGID: 1pzEJp-00072y-2T X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org [CCing Francesco Dolcini; and the regression list too, as it should be in the loop for regressions: https://docs.kernel.org/admin-guide/reporting-regressions.html] On 16.05.23 14:53, Alistair wrote: > On Fri, 2023-04-07 at 03:07 +0000, Badhri Jagan Sridharan wrote: >> usb_udc_connect_control does not check to see if the udc has already >> been started. This causes gadget->ops->pullup to be called through >> usb_gadget_connect when invoked from usb_udc_vbus_handler even before >> usb_gadget_udc_start is called. Guard this by checking for udc- >>> started >> in usb_udc_connect_control before invoking usb_gadget_connect. > [...] >> Cc: stable@vger.kernel.org >> Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler") >> Signed-off-by: Badhri Jagan Sridharan > > This patch causes a kernel hang when trying to boot with the > usb/chipidea/udc.c driver. > > The call stack below causes the hang: > > - gadget_bind_driver(struct device *dev) > - mutex_lock(&udc->connect_lock); > - usb_gadget_udc_start_locked(struct usb_udc *udc) > - udc->gadget->ops->udc_start(udc->gadget, udc->driver) > > At which point we are calling ci_udc_start(..), but with the > connect_lock mutex locked. > > ci_udc_start() then calls usb_udc_vbus_handler() which tries to lock > the connect_lock while it's already locked. Resulting in a kernel hang. > > Reverting this patch fixes the hang. Not my area of expertise, but I guess it might be the same error as this one: https://lore.kernel.org/all/ZF4BvgsOyoKxdPFF@francesco-nb.int.toradex.com/ Francesco sent a revert on Friday, but no reaction from Badhri Jagan Sridharan or Greg yet afaics. https://lore.kernel.org/all/20230512131435.205464-1-francesco@dolcini.it/ Ciao, Thorsten