Commit 6651d6cd9f2e856bcb1da481bc3b686762242392
1 parent
574f122979
Exists in
emb_lf_v2022.04
MA-18192 Only bump the rollback index when avb verify ok
AVB verify should fail for GKI boot image but we should allow it continue to boot in UNLOCKED state. In such case, we should not update the stored rollback index. This commit will update the rollback index only when the AVB verify is OK to prevent rollback index check error. Test: boots. Signed-off-by: Ji Luo <ji.luo@nxp.com> Change-Id: I82678d288edd4df6de40a1ca863ed36d3b3658a8 (cherry picked from commit ea48b544581d630bc031a7968a90b2fcf328424a) (cherry picked from commit 8619089859b6c24f82a2f6fda9bd2c58c2e38851) (cherry picked from commit 5893d8707dd66e0f36bc6dbd7c805cd20c05f725)
Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff
lib/avb/fsl/fsl_bootctrl.c
... | ... | @@ -989,7 +989,8 @@ |
989 | 989 | /* Update stored rollback index only when the slot has been marked |
990 | 990 | * as successful. Do this for every rollback index location. |
991 | 991 | */ |
992 | - if (ab_data.slot_info[target_slot].successful_boot != 0) { | |
992 | + if ((ret == AVB_AB_FLOW_RESULT_OK) && | |
993 | + (ab_data.slot_info[target_slot].successful_boot != 0)) { | |
993 | 994 | for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) { |
994 | 995 | |
995 | 996 | rollback_index_value = slot_data->rollback_indexes[n]; |
... | ... | @@ -1243,6 +1244,7 @@ |
1243 | 1244 | |
1244 | 1245 | case AVB_SLOT_VERIFY_RESULT_OK: |
1245 | 1246 | slot_index_to_boot = target_slot; |
1247 | + ret = AVB_AB_FLOW_RESULT_OK; | |
1246 | 1248 | n = 2; |
1247 | 1249 | break; |
1248 | 1250 | |
... | ... | @@ -1322,7 +1324,8 @@ |
1322 | 1324 | /* Update stored rollback index only when the slot has been marked |
1323 | 1325 | * as successful. Do this for every rollback index location. |
1324 | 1326 | */ |
1325 | - if (ab_data.slot_info[slot_index_to_boot].successful_boot != 0) { | |
1327 | + if ((ret == AVB_AB_FLOW_RESULT_OK) && | |
1328 | + (ab_data.slot_info[slot_index_to_boot].successful_boot != 0)) { | |
1326 | 1329 | for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) { |
1327 | 1330 | |
1328 | 1331 | rollback_index_value = slot_data[slot_index_to_boot]->rollback_indexes[n]; |