diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2012-05-05 19:43:06 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2012-05-05 19:43:06 +0000 |
| commit | 4fc4eac1c96565c70797c52e002f3bf09f319efc (patch) | |
| tree | d1a8135ba0d44fe6dcfc9c38b329e70d5cbece07 /LUFA/Drivers | |
| parent | 76d9dbdd7848f6889c9ccccf5b3e0ea6ab179f31 (diff) | |
Fixed possible deadlock in the CDC device driver if the USB connection is dropped while the CDC_REQ_SetLineEncoding control request is being processed by the stack (thanks to Jonathan Hudgins).
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@2180 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers')
| -rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDCClassDevice.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c index a16949cf..ff0f9bb5 100644 --- a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c @@ -69,8 +69,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter { Endpoint_ClearSETUP(); - while (!(Endpoint_IsOUTReceived())); - + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE(); CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8(); CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8(); |
