Commit 8619089859b6c24f82a2f6fda9bd2c58c2e38851

Authored by Ji Luo
Committed by Ye Li
1 parent 894c87785e

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)

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

lib/avb/fsl/fsl_bootctrl.c
... ... @@ -1002,7 +1002,8 @@
1002 1002 /* Update stored rollback index only when the slot has been marked
1003 1003 * as successful. Do this for every rollback index location.
1004 1004 */
1005   - if (ab_data.slot_info[target_slot].successful_boot != 0) {
  1005 + if ((ret == AVB_AB_FLOW_RESULT_OK) &&
  1006 + (ab_data.slot_info[target_slot].successful_boot != 0)) {
1006 1007 for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
1007 1008  
1008 1009 rollback_index_value = slot_data->rollback_indexes[n];
... ... @@ -1256,6 +1257,7 @@
1256 1257  
1257 1258 case AVB_SLOT_VERIFY_RESULT_OK:
1258 1259 slot_index_to_boot = target_slot;
  1260 + ret = AVB_AB_FLOW_RESULT_OK;
1259 1261 n = 2;
1260 1262 break;
1261 1263  
... ... @@ -1335,7 +1337,8 @@
1335 1337 /* Update stored rollback index only when the slot has been marked
1336 1338 * as successful. Do this for every rollback index location.
1337 1339 */
1338   - if (ab_data.slot_info[slot_index_to_boot].successful_boot != 0) {
  1340 + if ((ret == AVB_AB_FLOW_RESULT_OK) &&
  1341 + (ab_data.slot_info[slot_index_to_boot].successful_boot != 0)) {
1339 1342 for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
1340 1343  
1341 1344 rollback_index_value = slot_data[slot_index_to_boot]->rollback_indexes[n];