usb: f_gsi: Avoid starting transfer if disconnected
There is a possible race in which gsi_disable() is called
while ipa_work_handler() is still in the middle of handling
EVT_CONNECT_IN_PROGRESS event. This leads to an out-of-order
concurrency scenario in which GSI's EPs are first disabled
followed by ipa_connect_channels() proceeding to call GSI
ops to prepare TRBs and start the transfer. After this,
ipa_disconnect_work_handler() is called to free the TRBs
without stopping the transfer, and this results in the
controller hardware accessing stale unmapped DMA pointers.
Fix this specific scenario by avoiding calling
ipa_connect_channels() by peeking at the event queue to see
if EVT_DISCONNECTED was posted after EVT_CONNECT_IN_PROGRESS.
Change-Id: I66b8507eb48f4a994d3c372f1e7e92765abde1b4
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment