linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] usb: core: hub: fix race condition about TRSMRCY of resume
@ 2021-05-12  2:07 Chunfeng Yun
  0 siblings, 0 replies; only message in thread
From: Chunfeng Yun @ 2021-05-12  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern
  Cc: Matthias Brugger, Thinh Nguyen, Gustavo A . R . Silva,
	Bixuan Cui, Eugeniu Rosca, Oliver Neukum, linux-usb,
	linux-kernel, linux-arm-kernel, linux-mediatek, Tianping Fang,
	Eddie Hung, Ikjoon Jang, Chunfeng Yun, stable

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Tianping Fang <tianping.fang@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-12  2:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  2:07 [PATCH v2] usb: core: hub: fix race condition about TRSMRCY of resume Chunfeng Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).