Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp630671pxj; Tue, 18 May 2021 10:36:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrKB9qWe4mywHPjaG4Drc1j1uZ4JXlu4/Y8PEjndR1p855Pvlv3zTXRnnWg+5h1HHl1VBK X-Received: by 2002:a05:6602:2416:: with SMTP id s22mr902296ioa.15.1621359359996; Tue, 18 May 2021 10:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621359359; cv=none; d=google.com; s=arc-20160816; b=KbX3brEQM8o5ZiujMc0s5IHm12sqiMKVe0MFK+FWwfCAgBjtzgAMGqJqEbrRGWgbG6 mmhNsZOdOqxqik7Q+HyKsXfly/3FRTm7RQzWuiJP/1RTq1OWNB8fcLcyocgNov+jVnsH MPOiVln32DvWpe+etlj3PXmg1ff+QzVIEPmE3PcktRWpRk0ncpBYBTovx4ajl5kZe4/r 6vWPk2jCSYm83VtEmwpm/BygI3a0QKevyHqQIp3Bx2t/pHijrcpiCPAkuwlNDTD11++B M+s1QA7FhlPic879J2W90hXAROIsxWCsYvDAbedgi2JCvBk/QcgeA5kwxJyk44s7NePp mDWg== 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=o4O8KUpt8cb8UcqWyF+1ZcO972MHj5FS4DMefpiAuSU=; b=bnwhFEouZKG5q9txMb+MbYR8omZeoCur4O4PdS0uZ7bdM+F/MCRmKTTVnaIGroIT46 08H70329EYWRW+0MnGLAFDLI2gebXy6nPgJZtwDCn/6j4lQA0G6a+5J0B3omX7hN2fIN j0CkXWSu6mv/FA/UhW7571XqwkWqJDz30lXVMROPwOvB26//lAfWzEftY3S4096lGDKr S7s5b6nmBr2lmk3waoQmi8XNxfqkDNTBXtd+4xGjXFwnZ67viAAuUx2dQjdQp9Hph98r FTM5YGxPyCijA9Dj80zOj3qSxCTxeWL/N9FRm4XTWdIFLraYQlVUvkIpivUit14GsPKG sGEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=plR6AU3t; 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 y3si21556197iom.73.2021.05.18.10.34.58; Tue, 18 May 2021 10:35:59 -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=plR6AU3t; 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 S1346638AbhEQQJT (ORCPT + 99 others); Mon, 17 May 2021 12:09:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:55058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344964AbhEQPqJ (ORCPT ); Mon, 17 May 2021 11:46:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8569961414; Mon, 17 May 2021 14:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262646; bh=w6+YZ+eJESBL3jv7+rZ7DnvjXZlrGoaCIJKmNMxqdtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=plR6AU3tBcFZV58ocMioqvOfHS9dkcJ9Sahif5XBCCu9COvVCVow56ioy5E3coPPI 59JEjcsuiKunLoGy2vyDSxUmRETVJb8B/sAs3pnTgHitg7YF80Ms2QN2wvvYxJjZt2 0F8wAw927tJ40Z6BJ6viSB9mSx8nwbr9aEr0j0Qc= 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.10 244/289] usb: core: hub: fix race condition about TRSMRCY of resume Date: Mon, 17 May 2021 16:02:49 +0200 Message-Id: <20210517140313.367126955@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -3592,9 +3592,6 @@ int usb_port_resume(struct usb_device *u * sequence. */ status = hub_port_status(hub, port1, &portstatus, &portchange); - - /* TRSMRCY = 10 msec */ - msleep(10); } SuspendCleared: @@ -3609,6 +3606,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)