Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1726102rwl; Wed, 5 Apr 2023 23:37:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bW7nkByXc6zospUvV3Tbm8M77+FgNQXopTog8y3ZiT38NEk6q191DjJ0PUMfGdBeoxBAgy X-Received: by 2002:a17:903:32ca:b0:19c:dbce:dce8 with SMTP id i10-20020a17090332ca00b0019cdbcedce8mr11104426plr.15.1680763048029; Wed, 05 Apr 2023 23:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680763048; cv=none; d=google.com; s=arc-20160816; b=ubQ/q1T3jJvbbpaPyqr2hVMsifBAUjskMBQOLs1IoBsxzgiAji2jAjdnaOn17yWH+T puU5hyAXPSrn6arjnRIi7pkLEZyXauuJu3x2HQuVhfOC2HX7/uadPbc+nY5FQKH14XBc qr6MUvskfCzHN6p9ho/nh+bjT3zgNsR6KK9frb5/BgrNYL++2Wlge0MqRTA2p3oN6wqB A5VTEI9kyy8qVPBwx8x1B0nmiIudSQNK6TjuIMwyoJtWfdiGl9yUnUrXvLzY4rS9eXhR +GVsARpA3g8A03AhM+tXRLB0+TPLMrIoLOPSbmCtsd+qEcN1tNI8fuIg29BDVlA6raZ6 PVWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q4iL7UpACB9Lcz5/mWRkijDwlzHc3wu8Rm9uPMM5C0A=; b=edBw4PIQhu7/srpD1RvDIGSTSu9i0DPO05v97+f6dLJj63yO4uRgCciggdddZoNa1e zluH0K0l6OARmc/G8wtfANXVYzM7l+8hPnH7d5dE/K6OX97fV462u0c2sStxPM+uPUl7 ixbLYcZZ8yWRU///7W4sabcOD5WcP+bD+IX/liioiaYlXtXQyMfleBvnX1G8TWTRuYu5 8hVCD/JgPYxUiGMig53OB5Q6HO7z/HtfhwfR29EqIcQ6ikKRZ6z2TwB1NzEDIOl/PcyA LbVRxAyDMYZs8aFACUUsZrBQn90+9Qdv0BjcMOZ4NWR4S0By8QdIqlUeppxXG1e08f8S sXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4MgTOyG; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a631710000000b004e8529ae3eesi553148pgl.294.2023.04.05.23.37.16; Wed, 05 Apr 2023 23:37:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4MgTOyG; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235166AbjDFG3s (ORCPT + 99 others); Thu, 6 Apr 2023 02:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234979AbjDFG3q (ORCPT ); Thu, 6 Apr 2023 02:29:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F2B9011; Wed, 5 Apr 2023 23:29:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A3E461A36; Thu, 6 Apr 2023 06:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98A39C433EF; Thu, 6 Apr 2023 06:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680762582; bh=x5miUEFRGRABKM7T3QNdRkXo6e+VmkF7ljbww95aenQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=y4MgTOyGXuhsEQW43AlnaqF/y/RA9p1Hj7DYxgAoI/i7vCf9E8kTOvwxWsCNTtDqC mFyK2A9thYRrECZAoAyl9jUN0AxGE3js8EZn1Lgdthf4H4lNV/5ikTCaFyxgOQ1Ldn MqfgKhHfrdvd6IpcWNwJcsoxbFnkuU1lT8kFKQJw= Date: Thu, 6 Apr 2023 08:29:38 +0200 From: Greg KH To: Badhri Jagan Sridharan Cc: 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, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started Message-ID: References: <20230406061905.2460827-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230406061905.2460827-1-badhri@google.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Thu, Apr 06, 2023 at 06:19:04AM +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. > > Guarding udc_connect_control, udc->started and udc->vbus > with its own mutex as usb_udc_connect_control_locked > can be simulataneously invoked from different code paths. > > Cc: stable@vger.kernel.org > > Signed-off-by: Badhri Jagan Sridharan > Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler") > --- > drivers/usb/gadget/udc/core.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) Why resend v1 when it's been reviewed already? confused, greg k-h