Skip to content

Commit

Permalink
usb: core: hub: fix race condition about TRSMRCY of resume
Browse files Browse the repository at this point in the history
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: <[email protected]>
Reported-by: Tianping Fang <[email protected]>
Acked-by: Alan Stern <[email protected]>
Signed-off-by: Chunfeng Yun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Chunfeng Yun authored and gregkh committed May 13, 2021
1 parent 12701ce commit 975f94c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 975f94c

Please sign in to comment.