aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2021-05-12 10:07:38 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-19 10:08:31 +0200
commit7f15d999dd61821cebf73252fda94d6f0b8c4c2f (patch)
tree517ea7ee8ae0016ba2b14f5c486e57e56285622c
parent8f536512db87ead2947091e94a73e870053dad6f (diff)
downloadlinux-yocto-7f15d999dd61821cebf73252fda94d6f0b8c4c2f.tar.gz
linux-yocto-7f15d999dd61821cebf73252fda94d6f0b8c4c2f.tar.bz2
linux-yocto-7f15d999dd61821cebf73252fda94d6f0b8c4c2f.zip
usb: core: hub: fix race condition about TRSMRCY of resume
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: <stable@vger.kernel.org> Reported-by: Tianping Fang <tianping.fang@mediatek.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/20210512020738.52961-1-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/core/hub.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index cd61860cada5..6c89d714adb6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3574,9 +3574,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:
@@ -3591,6 +3588,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)