Skip to content

Commit cb64eca

Browse files
committed
[nrf fromtree] boot: Fix swap-move algorithm failing to validate multi-image
In multi image swap validation of images could fail due to headers being incorrectly re-read from storage. Fixes #1768 Signed-off-by: Dominik Ermel <[email protected]> (cherry picked from commit 6f7f873)
1 parent 42a1eb6 commit cb64eca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

boot/bootutil/src/loader.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (c) 2016-2020 Linaro LTD
55
* Copyright (c) 2016-2019 JUUL Labs
66
* Copyright (c) 2019-2023 Arm Limited
7+
* Copyright (c) 2024 Nordic Semiconductor ASA
78
*
89
* Original license:
910
*
@@ -2372,8 +2373,13 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
23722373
if (BOOT_SWAP_TYPE(state) != BOOT_SWAP_TYPE_NONE) {
23732374
/* Attempt to read an image header from each slot. Ensure that image
23742375
* headers in slots are aligned with headers in boot_data.
2376+
* Note: Quite complicated internal logic of boot_read_image_headers
2377+
* uses boot state, the last parm, to figure out in which slot which
2378+
* header is located; when boot state is not provided, then it
2379+
* is assumed that headers are at proper slots (we are not in
2380+
* the middle of moving images, etc).
23752381
*/
2376-
rc = boot_read_image_headers(state, false, &bs);
2382+
rc = boot_read_image_headers(state, false, NULL);
23772383
if (rc != 0) {
23782384
FIH_SET(fih_rc, FIH_FAILURE);
23792385
goto out;

0 commit comments

Comments
 (0)