Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp68101pxj; Thu, 20 May 2021 04:45:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8dMtjpFylyNqsFp0fahZGE8YIZFs2SxacZpL4VrYGBWJfHus7h1QJ8RaiIZsfCD+4Qy3/ X-Received: by 2002:a17:907:628a:: with SMTP id nd10mr4314198ejc.326.1621511138943; Thu, 20 May 2021 04:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621511138; cv=none; d=google.com; s=arc-20160816; b=jGmvIyaqUV28ix8p0dXECySJv4JMs1VqIQNRJYV+T5DgVMogeEy0wsoHzzOUGxOyGq ID5uUzXGbb8BxPW0Pp5IDNXaBievxX/75NlsW2lNwOqVZ+YbXjC0T+1B3RfUe4upUa1o PXGOSK+bvVZeckUJ3PsFBAG4G0Ff+vuch1yjF4NqR2BCJ4zr519a2mWBeh0pEO+iOcWW nxaSfimiLKdkUflKVKXuV9QJCgs4knjweY1vJG7lk40OJAMUnyYCcfR3wh7cppqoLsCw XpwoBXt7JKejsBMNRsyPgOGETuQnF/1pjeAbOgsKWwMZUgZkU1BfH4I87trK06auQJJI xnpw== 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=HIKvhftBZWZVshfVPraxn2gpnF9wEo5eMsK9SUG4zoQ=; b=Adt9lhSdq0Y9hWXSE7N3MQQgYX7RF9LqS3ngRRz3YNN0PFqwTsh5nLQSRCJ80LPC11 6Z+mCPHY96vaUXctlD+Y+Di80EJlnTsIK9OqM3IIxTVhjKiDwit5B1XCr9+88jHNrVyp 4eCIDLZIvbibOs0FHBd/hxtpcD7XTrWbFvZ9OdZQgyNICDGNtbyd5X5rfpKTHrF/G8xE XJ/PVsYvlA9LmRtjhDjaUI6hxNQVP1sG5TWj71b5Eok7KBJKEqxEl7pn/jViDKIqZdZr /7wXG8z2c/w6ef6UUYNVgReHEpaEnulQSyKqHgl4voGW4wfP4uLUeSCj4g+SK0BH33T3 33QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UWUGeRDx; 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 dn5si1994822edb.122.2021.05.20.04.45.10; Thu, 20 May 2021 04:45:38 -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=UWUGeRDx; 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 S242305AbhETLnU (ORCPT + 99 others); Thu, 20 May 2021 07:43:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:43486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239239AbhETLW2 (ORCPT ); Thu, 20 May 2021 07:22:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FBDA61D8D; Thu, 20 May 2021 10:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505511; bh=H+iePsEJXbIzUdlHnlEkKi0VxFRP4qzqQ+3bdi8ZSzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWUGeRDxai6ttNaoMOjk6Y3w9nD4t5PLns2sheQIYT+zj0/3uFsIZeZcavu/PcrOs FU6Cjm+9lSRiQvdPrQmdhB2GB2U5zpt4jFVhQs7AgItm4dNAxQLTXHVKageZhMLCSW NTVBCRuAc56LtWgvmmKnQCY6A9Cw70yhRhEJcviQ= 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.4 168/190] usb: core: hub: fix race condition about TRSMRCY of resume Date: Thu, 20 May 2021 11:23:52 +0200 Message-Id: <20210520092107.730868243@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 @@ -3430,9 +3430,6 @@ int usb_port_resume(struct usb_device *u * sequence. */ status = hub_port_status(hub, port1, &portstatus, &portchange); - - /* TRSMRCY = 10 msec */ - msleep(10); } SuspendCleared: @@ -3447,6 +3444,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 && hub_is_superspeed(hub->hdev))