micropython-lib/micropython/usb/usb-device
Angus Gratton 1d3c722b7d usb: Fix race if transfers are submitted by a thread.
The USB pending transfer flag was cleared before calling the completion
callback, to allow the callback code to call submit_xfer() again.

Unfortunately this isn't safe in a multi-threaded environment, as another
thread may see the endpoint is available before the callback is done
executing and submit a new transfer.

Rather than adding extra locking, specifically treat the transfer as still
pending if checked from another thread while the callback is executing.

Closes #874

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-11 17:13:53 +10:00
..
tests usb: Add USB device support packages. 2024-04-30 15:57:50 +10:00
usb/device usb: Fix race if transfers are submitted by a thread. 2024-09-11 17:13:53 +10:00
manifest.py usb: Fix race if transfers are submitted by a thread. 2024-09-11 17:13:53 +10:00