mirror of https://github.com/ARMmbed/mbed-os.git
Fix unbalanced USBDevice unlock
Remove calls to unlock which are not preceded by calls to lock. Also move the location of the unlock underflow assert so unbalanced unlocking during post processing is caught.pull/9768/head
parent
793044eb26
commit
d5fc72d5b4
|
@ -331,13 +331,11 @@ void USBDevice::_complete_request_xfer_done()
|
||||||
_transfer.user_callback = None;
|
_transfer.user_callback = None;
|
||||||
if (_abort_control) {
|
if (_abort_control) {
|
||||||
_control_abort();
|
_control_abort();
|
||||||
unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
_phy->ep0_stall();
|
_phy->ep0_stall();
|
||||||
unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +403,6 @@ void USBDevice::_complete_set_configuration()
|
||||||
_transfer.user_callback = None;
|
_transfer.user_callback = None;
|
||||||
if (_abort_control) {
|
if (_abort_control) {
|
||||||
_control_abort();
|
_control_abort();
|
||||||
unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +475,6 @@ void USBDevice::_complete_set_interface()
|
||||||
_transfer.user_callback = None;
|
_transfer.user_callback = None;
|
||||||
if (_abort_control) {
|
if (_abort_control) {
|
||||||
_control_abort();
|
_control_abort();
|
||||||
unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +712,6 @@ void USBDevice::_complete_request()
|
||||||
} else {
|
} else {
|
||||||
_control_abort();
|
_control_abort();
|
||||||
}
|
}
|
||||||
unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,8 +1558,6 @@ void USBDevice::lock()
|
||||||
|
|
||||||
void USBDevice::unlock()
|
void USBDevice::unlock()
|
||||||
{
|
{
|
||||||
MBED_ASSERT(_locked > 0);
|
|
||||||
|
|
||||||
if (_locked == 1) {
|
if (_locked == 1) {
|
||||||
// Perform post processing before fully unlocking
|
// Perform post processing before fully unlocking
|
||||||
while (_post_process != NULL) {
|
while (_post_process != NULL) {
|
||||||
|
@ -1574,6 +1567,7 @@ void USBDevice::unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MBED_ASSERT(_locked > 0);
|
||||||
_locked--;
|
_locked--;
|
||||||
core_util_critical_section_exit();
|
core_util_critical_section_exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue