@@ -1865,8 +1865,8 @@ boot_perform_update(struct boot_loader_state *state, struct boot_status *bs)
18651865 * swap was finished to avoid a new revert.
18661866 */
18671867 swap_type = BOOT_SWAP_TYPE (state );
1868- if (swap_type == BOOT_SWAP_TYPE_REVERT ||
1869- swap_type == BOOT_SWAP_TYPE_PERM ) {
1868+ if (( swap_type == BOOT_SWAP_TYPE_REVERT || swap_type == BOOT_SWAP_TYPE_PERM )
1869+ && (! IS_NSIB_OWNED ( BOOT_CURR_IMG ( state ))) ) {
18701870 rc = swap_set_image_ok (BOOT_CURR_IMG (state ));
18711871 if (rc != 0 ) {
18721872 BOOT_SWAP_TYPE (state ) = swap_type = BOOT_SWAP_TYPE_PANIC ;
@@ -1893,7 +1893,7 @@ boot_perform_update(struct boot_loader_state *state, struct boot_status *bs)
18931893 }
18941894#endif /* MCUBOOT_HW_ROLLBACK_PROT */
18951895
1896- if (BOOT_IS_UPGRADE (swap_type )) {
1896+ if (BOOT_IS_UPGRADE (swap_type ) && (! IS_NSIB_OWNED ( BOOT_CURR_IMG ( state ))) ) {
18971897 rc = swap_set_copy_done (BOOT_CURR_IMG (state ));
18981898 if (rc != 0 ) {
18991899 BOOT_SWAP_TYPE (state ) = BOOT_SWAP_TYPE_PANIC ;
@@ -1929,8 +1929,8 @@ boot_complete_partial_swap(struct boot_loader_state *state,
19291929 /* The following states need image_ok be explicitly set after the
19301930 * swap was finished to avoid a new revert.
19311931 */
1932- if (bs -> swap_type == BOOT_SWAP_TYPE_REVERT ||
1933- bs -> swap_type == BOOT_SWAP_TYPE_PERM ) {
1932+ if (( bs -> swap_type == BOOT_SWAP_TYPE_REVERT || bs -> swap_type == BOOT_SWAP_TYPE_PERM )
1933+ && (! IS_NSIB_OWNED ( BOOT_CURR_IMG ( state ))) ) {
19341934 rc = swap_set_image_ok (BOOT_CURR_IMG (state ));
19351935 if (rc != 0 ) {
19361936 BOOT_SWAP_TYPE (state ) = BOOT_SWAP_TYPE_PANIC ;
@@ -2479,10 +2479,12 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
24792479 * pretending we just reverted back to primary slot.
24802480 */
24812481#ifndef MCUBOOT_OVERWRITE_ONLY
2482- /* image_ok needs to be explicitly set to avoid a new revert. */
2483- rc = swap_set_image_ok (BOOT_CURR_IMG (state ));
2484- if (rc != 0 ) {
2485- BOOT_SWAP_TYPE (state ) = BOOT_SWAP_TYPE_PANIC ;
2482+ if (!IS_NSIB_OWNED (BOOT_CURR_IMG (state ))) {
2483+ /* image_ok needs to be explicitly set to avoid a new revert. */
2484+ rc = swap_set_image_ok (BOOT_CURR_IMG (state ));
2485+ if (rc != 0 ) {
2486+ BOOT_SWAP_TYPE (state ) = BOOT_SWAP_TYPE_PANIC ;
2487+ }
24862488 }
24872489#endif /* !MCUBOOT_OVERWRITE_ONLY */
24882490 break ;
0 commit comments