laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
dfu: protect USB_DFU_STATE_DFU_MANIFEST by a critical section

In the MANIFEST state, the IRQ won't move the state, but
to prevent incosistency between dfu_manifestation_complete &
dfu_state, use a critical section.

Change-Id: Idf5fb7d55b4051ba7e235dfa409a4de18a8f208c
---
M usb_start.c
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/usb_start.c b/usb_start.c
index 78711f1..0b99746 100644
--- a/usb_start.c
+++ b/usb_start.c
@@ -189,12 +189,14 @@
case USB_DFU_STATE_DFU_MANIFEST: // we can start manifestation (finish flashing)
// in theory every DFU files should have a suffix to with a CRC to check the data
// in practice most downloaded files are just the raw binary with DFU suffix
+ CRITICAL_SECTION_ENTER();
dfu_manifestation_complete = true; // we completed flashing and all checks
if (usb_dfu_func_desc->bmAttributes & USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT) {
dfu_state = USB_DFU_STATE_DFU_MANIFEST_SYNC;
} else {
dfu_state = USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET;
}
+ CRITICAL_SECTION_LEAVE();
break;
case USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET:
if (usb_dfu_func_desc->bmAttributes & USB_DFU_ATTRIBUTES_WILL_DETACH) {

To view, visit change 42176. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-Change-Id: Idf5fb7d55b4051ba7e235dfa409a4de18a8f208c
Gerrit-Change-Number: 42176
Gerrit-PatchSet: 6
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>