[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210512020738.52961-1-chunfeng.yun@mediatek.com>
Date: Wed, 12 May 2021 10:07:38 +0800
From: Chunfeng Yun <chunfeng.yun@...iatek.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>
CC: Matthias Brugger <matthias.bgg@...il.com>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
Bixuan Cui <cuibixuan@...wei.com>,
Eugeniu Rosca <erosca@...adit-jv.com>,
Oliver Neukum <oneukum@...e.com>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
Tianping Fang <tianping.fang@...iatek.com>,
Eddie Hung <eddie.hung@...iatek.com>,
Ikjoon Jang <ikjn@...omium.org>,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
<stable@...r.kernel.org>
Subject: [PATCH v2] usb: core: hub: fix race condition about TRSMRCY of resume
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: <stable@...r.kernel.org>
Acked-by: Alan Stern <stern@...land.harvard.edu>
Reported-by: Tianping Fang <tianping.fang@...iatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
---
v2:
cc stable suggested by Alan,
and add acked-by Alan
---
drivers/usb/core/hub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b2bc4b7c4289..fc7d6cdacf16 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3642,9 +3642,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
* sequence.
*/
status = hub_port_status(hub, port1, &portstatus, &portchange);
-
- /* TRSMRCY = 10 msec */
- msleep(10);
}
SuspendCleared:
@@ -3659,6 +3656,9 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
usb_clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_SUSPEND);
}
+
+ /* TRSMRCY = 10 msec */
+ msleep(10);
}
if (udev->persist_enabled)
--
2.18.0
Powered by blists - more mailing lists