Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp465328pxj; Thu, 20 May 2021 13:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhFERIIuuQVNw5n1KUJ6Lovo0osOKVZbNSXvqvm2q+E3C0xL1a6+7pwUJlGtJPTbwvAnIa X-Received: by 2002:a05:6e02:118b:: with SMTP id y11mr8062327ili.241.1621543024978; Thu, 20 May 2021 13:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621543024; cv=none; d=google.com; s=arc-20160816; b=noel5bUlTEIHNRKknG3qkCbUvGa6q0VLlMCUUZB/bBPnaY22R9kHyOnl0SrVYJ/GUO Qb/NSnrNp92J2882IvuMI3MMSRjdwpCxMEkFpZ2FxPjZav9i7RtHrYPeX3akeqUtUr6b kgO3ds+S9VqhbnI1M6uM+/me9usGbB0t6RnVEvkJ5WJVDqmq2Jpf1AUo8pypX07Af5DT QPXh+QBVklWYU5UnxaG+tooxo6KpZ1v5izHlXjgTljEDj731f9yZo2vPuCsLO4eRjGaq w0EP2PmX/vnIqiVHaDpweopMtWY5Cis3yrpvcXyzCuoUp5TkPYV8tpRhfeUwqsRA90iL ynsA== 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=YI+DYV4VFqk9r/kUg7M96kr0RTJClKqpNxZzd6D0H2M=; b=Nkk75u5gI72Gov5H8n6uvgttXFXTR+YhIsKU+uzaCE9VQmRvYEf+FQ/MOL4mWwdwmu Wz/a4MIZuwAhfFzpn+c4/Poi9R+iqu+O5gxTzfRP3gtaN7BiLMOUqu0EmPnb9VaTHpZA kO2ceQ2MlUGRp1KJOBEBdcn4ZkloiVfrj3LPm3dRyJt9u0FNgDsmkF4tTmd5858NlDvu u8sc7bvPiLD0ZHoBEQEr7tRa5BzJAFdEWqtuqxIu7yJggUgaEA7kOqpDarE7Tz4TxWSg +AangyJzL2BZKlOexBW4oYiU8gdxU1l2asbj8CqTJIosxoeGr5H2aqyVB1Jv6ng0Jyrh 3gJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gNIknNZn; 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 g6si3430886ila.98.2021.05.20.13.36.49; Thu, 20 May 2021 13:37:04 -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=gNIknNZn; 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 S238571AbhETKzl (ORCPT + 99 others); Thu, 20 May 2021 06:55:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:40016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236701AbhETKkJ (ORCPT ); Thu, 20 May 2021 06:40:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D0F6161C7F; Thu, 20 May 2021 09:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504532; bh=d+6/f3oF6CqomtznNTfk6ZJN0HErve5nwFS2UQAcDcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNIknNZn9QwC1qkg5o040+vhtItioA536D3hScI9sWGTXa2T8hU9hMTFlzNJgNmSf iMb7hnVJbZx2kFKW26KVWhN2Xk6KsVZ/ey75HIMi3TgHOVn0Cv6P0ajjqrd3I0194Y S4015joA9aq6gNlfu94CtmAwBc0OH8Jsf/dcDCPk= 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.14 289/323] usb: core: hub: fix race condition about TRSMRCY of resume Date: Thu, 20 May 2021 11:23:01 +0200 Message-Id: <20210520092130.118203075@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 @@ -3496,9 +3496,6 @@ int usb_port_resume(struct usb_device *u * sequence. */ status = hub_port_status(hub, port1, &portstatus, &portchange); - - /* TRSMRCY = 10 msec */ - msleep(10); } SuspendCleared: @@ -3513,6 +3510,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)