diff options
author | Ji Luo <ji.luo@nxp.com> | 2020-10-30 16:14:09 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2020-10-30 16:31:24 +0800 |
commit | ea48b544581d630bc031a7968a90b2fcf328424a (patch) | |
tree | b4e6a549bfa365f08b160bc7035bae2696316ed2 /lib | |
parent | 6db6c8bf1a60baad7032f92822a0030b077d3602 (diff) |
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
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/avb/fsl/fsl_bootctrl.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/avb/fsl/fsl_bootctrl.c b/lib/avb/fsl/fsl_bootctrl.c index 004c7f8974..60ca7cba0d 100755 --- a/lib/avb/fsl/fsl_bootctrl.c +++ b/lib/avb/fsl/fsl_bootctrl.c @@ -1002,7 +1002,8 @@ AvbABFlowResult avb_flow_dual_uboot(AvbABOps* ab_ops, /* Update stored rollback index only when the slot has been marked * as successful. Do this for every rollback index location. */ - if (ab_data.slot_info[target_slot].successful_boot != 0) { + if ((ret == AVB_AB_FLOW_RESULT_OK) && + (ab_data.slot_info[target_slot].successful_boot != 0)) { for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) { rollback_index_value = slot_data->rollback_indexes[n]; @@ -1256,6 +1257,7 @@ AvbABFlowResult avb_ab_flow_fast(AvbABOps* ab_ops, case AVB_SLOT_VERIFY_RESULT_OK: slot_index_to_boot = target_slot; + ret = AVB_AB_FLOW_RESULT_OK; n = 2; break; @@ -1335,7 +1337,8 @@ AvbABFlowResult avb_ab_flow_fast(AvbABOps* ab_ops, /* Update stored rollback index only when the slot has been marked * as successful. Do this for every rollback index location. */ - if (ab_data.slot_info[slot_index_to_boot].successful_boot != 0) { + if ((ret == AVB_AB_FLOW_RESULT_OK) && + (ab_data.slot_info[slot_index_to_boot].successful_boot != 0)) { for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) { rollback_index_value = slot_data[slot_index_to_boot]->rollback_indexes[n]; |