Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp138007pxj; Mon, 17 May 2021 23:14:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz20DObpCPwZjXWNQy7bCdsNCBFZOIKCdgUKroaJZ83e25yOlPk9ysasfwdA9/U3zcTvSgC X-Received: by 2002:a05:6402:14c2:: with SMTP id f2mr5110600edx.69.1621318494250; Mon, 17 May 2021 23:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318494; cv=none; d=google.com; s=arc-20160816; b=V0TFWIqDf28fzb30bUo80ryweqXRjMh17TCH3kXJYQa7T7FCve3p2ZCKddLW7Gluv8 bS4PyuQPtnwPFW/nK6LbX4KLUMyFSV8OMs/WR6rTDFzySS1/DBr7IwNdYA2baurqAY3d Qd8EOI6nfpT05dZS+QSH+4ADQup0p550GcxIYwjyK/NKwwPbrUA3Wt4zWqzDWCNvPP0y V8uOEH3iurwKsSEoLl8VW7GQCLcIpfrimwNy8dS6JotWBh7X7t247Ry/bY8YsUtLIHMS XKDzVVauk2b3KU7N29VE1ybGBpfAFEz4VzMo6ZaMR1DcwVXzNOI7Tw+wGL4jp5DcC+xT au2g== 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=PZKPC1CXY3i809kL9O0NzbNgUBBL8puIsT3BqAHOozE=; b=eqISzgrsrOnY1+pBNal94lfsai/4L11c/aFLo+1ysvmvvKhs+Cc4VqBIc6yC363YK0 v4u4JVWwDZy7CbB/9jRsXwMoXRgJpzJqjfNj7Dbbg6bHvizxAoPvbXl9w7eYxIqP/PFb HE48GzacPqBz4cT+3KmSc+Roe6b6raEgDXzrVvgfvVHXAL8lCoCfSE5TuFYTJUtMUtCg UP2rDybpVol/WohyuL1PWYJu37wJLyUfyV872R5pF/LgX9onUEKzhaI82nXRZ4ozs31z oGriE4o9TtU7l30oa5eukNS7GMZIZMu79DGz6Qng4vV25/92Uy+3Yq0lR6mgYb2YwL9x 4XcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=btox8Z1z; 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 q8si16401341ejr.28.2021.05.17.23.14.31; Mon, 17 May 2021 23:14:54 -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=btox8Z1z; 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 S240364AbhEQOtC (ORCPT + 99 others); Mon, 17 May 2021 10:49:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241284AbhEQOkO (ORCPT ); Mon, 17 May 2021 10:40:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 890B261948; Mon, 17 May 2021 14:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261133; bh=h9mRFJjQQj6oMwyIU4588+57hPM9/C0HzBWCZxB1mDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btox8Z1zdB3q0RHyw0ZEFHigYrlXPODu+vxpeE8M08YjtyDWqUFsBVCYlqRxbfWcg pyjk5y018xB/o0t4d36m9o6wMXAzQIcw6+lI8CijYijQoOwiJJZ6FugF6siBT5SXb6 Yiw2r/TAD+7V0hs6ev0CVS/UHYN9Zqxrly06rXTo= 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 5.12 312/363] usb: core: hub: fix race condition about TRSMRCY of resume Date: Mon, 17 May 2021 16:02:58 +0200 Message-Id: <20210517140313.150741416@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 @@ -3593,9 +3593,6 @@ int usb_port_resume(struct usb_device *u * sequence. */ status = hub_port_status(hub, port1, &portstatus, &portchange); - - /* TRSMRCY = 10 msec */ - msleep(10); } SuspendCleared: @@ -3610,6 +3607,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)