Skip to content

Commit edbba13

Browse files
committed
USBHostMSD : fix possible race condition during connection
1 parent d30a9a6 commit edbba13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

features/unsupported/USBHost/USBHostMSD/USBHostMSD.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ bool USBHostMSD::connect()
7474
break;
7575

7676
if (msd_device_found) {
77+
/* As this is done in a specific thread
78+
* this lock is taken to avoid to process a disconnection in
79+
* usb process during the device registering */
80+
USBHost::Lock Lock(host);
81+
7782
bulk_in = dev->getEndpoint(msd_intf, BULK_ENDPOINT, IN);
7883
bulk_out = dev->getEndpoint(msd_intf, BULK_ENDPOINT, OUT);
7984

0 commit comments

Comments
 (0)