Skip to content

Commit 6f7f873

Browse files
committed
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]>
1 parent 4b4cc85 commit 6f7f873

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
*
@@ -2211,8 +2212,13 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
22112212
if (BOOT_SWAP_TYPE(state) != BOOT_SWAP_TYPE_NONE) {
22122213
/* Attempt to read an image header from each slot. Ensure that image
22132214
* headers in slots are aligned with headers in boot_data.
2215+
* Note: Quite complicated internal logic of boot_read_image_headers
2216+
* uses boot state, the last parm, to figure out in which slot which
2217+
* header is located; when boot state is not provided, then it
2218+
* is assumed that headers are at proper slots (we are not in
2219+
* the middle of moving images, etc).
22142220
*/
2215-
rc = boot_read_image_headers(state, false, &bs);
2221+
rc = boot_read_image_headers(state, false, NULL);
22162222
if (rc != 0) {
22172223
FIH_SET(fih_rc, FIH_FAILURE);
22182224
goto out;

0 commit comments

Comments
 (0)