Skip to content

Commit 5915d40

Browse files
committed
Fix logic in emergency update
1 parent 533fa9b commit 5915d40

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/update_flash.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,18 @@ void RAMFUNCTION wolfBoot_start(void)
266266
(wolfBoot_verify_integrity(&boot) < 0) ||
267267
(wolfBoot_verify_authenticity(&boot) < 0)) {
268268
if (wolfBoot_update(1) < 0) {
269+
/* panic: no boot option available. */
269270
while(1)
270-
/* panic */;
271+
;
272+
} else {
273+
/* Emergency update successful, try to re-open boot image */
274+
if ((wolfBoot_open_image(&boot, PART_BOOT) < 0) ||
275+
(wolfBoot_verify_integrity(&boot) < 0) ||
276+
(wolfBoot_verify_authenticity(&boot) < 0)) {
277+
/* panic: something went wrong after the emergency update */
278+
while(1)
279+
;
280+
}
271281
}
272282
}
273283
hal_prepare_boot();

0 commit comments

Comments
 (0)