Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp382916pxj; Thu, 20 May 2021 11:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkT28mpA3hl4Cmj8lT79MEO0kD+5G7coE7+6jwxYdlOTTykm71s5sNaWSjidolq9YDKuLa X-Received: by 2002:a17:906:33da:: with SMTP id w26mr6099177eja.242.1621535460701; Thu, 20 May 2021 11:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621535460; cv=none; d=google.com; s=arc-20160816; b=TtPspTKv2T0OMmSfWG1647PxJOy+IpOPHp5hLUj3pHUYhQhr33yes8XKYOBpqIOJhJ XDlHJhdGwHWPU9NegeSS7XOPwzJuo1lFDY/efFqxNmoXytbTuS1Qj3A8r3wuzJU096p/ 6rfbTl0T517ZwfSqSJI/MFaaJ8udP55Ewx5GwxJWM9EQJ0YFV4boZ6O9L78o11JXQvKw DZBbJr7I293Run1CWYpVIIWmQWIKnzSpbRty2yVRigwP80CQECuzcjOBT9qBIMcW90jO Obg4wlAszaDDaW6tSo6iCMTsVABTGnbX9vJR0QN/4PDw8n/611f/k36YjgVZx8XE9KdV xhWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Unpua070HzPvBRR2wG0TgXrTIDC9INV0+dt4a1gwmnY=; b=G0u0VJvxK4pkt4Kul1QI4JPDglSoIR5zdSbATp4Ls6qFTZb/svYWkSG+C5AlNeBOzB xhLPht7KeUHs4130+GAccXEaR/vFwey4OfN16IuAtwAslvc+iXl+zMustLfPmZWacoxP eQycDlmhz5e5xy4opJ1sT1Dqq2ISjrRAgh4RAEUgutJ20+LWLv5WFX++fHCUyArzBhjr J5VH0sboC5wtfsnQd6tckPAGAGoQGH70x8Ym5Xw9GyXHLH98NacKJ2YRO+5molT8Yh8a tN1GDhiLsrodvgGUraxwPA15jccU4eytxNZ+8+ZoeiPpvUr+g/x4FaZoImobE/zDgbWT B8sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="B/ayX8dV"; 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=pass (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 g21si2876903edv.363.2021.05.20.11.30.36; Thu, 20 May 2021 11:31:00 -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=@linuxfoundation.org header.s=korg header.b="B/ayX8dV"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236593AbhETKTz (ORCPT + 99 others); Thu, 20 May 2021 06:19:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236027AbhETKKH (ORCPT ); Thu, 20 May 2021 06:10:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 118846195C; Thu, 20 May 2021 09:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503780; bh=Nr2UyS5O9GbSvzBZgqZxImUZAKmN8r9OxMeGt7I8qKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/ayX8dVlgKD4XUqV14qAaETSboSDBthB8KMxavbQgTYNwCvCBbX3eJrvILoJyjwc cg9/YTXy/BD1Hkbwb0q2u607zecL4hc07BWG39hwmgvDdzG/o17ABmBhJwZllxC1L6 1ZiKMVJKhC6/ui6Xgk3SuxV5SVwVLZMalCUfBG38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianping Fang , Alan Stern , Chunfeng Yun Subject: [PATCH 4.19 377/425] usb: core: hub: fix race condition about TRSMRCY of resume Date: Thu, 20 May 2021 11:22:26 +0200 Message-Id: <20210520092143.782761921@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chunfeng Yun commit 975f94c7d6c306b833628baa9aec3f79db1eb3a1 upstream. This may happen if the port becomes resume status exactly when usb_port_resume() gets port status, it still need provide a TRSMCRY time before access the device. CC: Reported-by: Tianping Fang Acked-by: Alan Stern Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/20210512020738.52961-1-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3539,9 +3539,6 @@ int usb_port_resume(struct usb_device *u * sequence. */ status = hub_port_status(hub, port1, &portstatus, &portchange); - - /* TRSMRCY = 10 msec */ - msleep(10); } SuspendCleared: @@ -3556,6 +3553,9 @@ int usb_port_resume(struct usb_device *u usb_clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_SUSPEND); } + + /* TRSMRCY = 10 msec */ + msleep(10); } if (udev->persist_enabled)