[PATCH] usb: core: hub: fix race condition about TRSMRCY of resume
Alan Stern
stern at rowland.harvard.edu
Tue May 11 09:39:07 PDT 2021
On Tue, May 11, 2021 at 06:15:22PM +0800, Chunfeng Yun wrote:
> 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.
>
> Reported-by: Tianping Fang <tianping.fang at mediatek.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun at mediatek.com>
This should also say:
CC: <stable at vger.kernel.org>
> ---
> 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)
Acked-by: Alan Stern <stern at rowland.harvard.edu>
More information about the Linux-mediatek
mailing list