lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42176?usp=email )
Change subject: dfu: protect USB_DFU_STATE_DFU_MANIFEST by a critical section ......................................................................
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(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/76/42176/1
diff --git a/usb_start.c b/usb_start.c index bf06596..7b164a0 100644 --- a/usb_start.c +++ b/usb_start.c @@ -199,12 +199,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) {