diff options
author | Hsuan Ting Chen <roccochen@chromium.org> | 2021-09-17 22:09:26 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-23 11:36:01 +0000 |
commit | 4b31e1a9b02cb0eaca01491888cf40b8f7023545 (patch) | |
tree | 498ea719430e39917911f09553b6e76f9bd8bfe8 /firmware | |
parent | 8d052c7151b543e787da8fdd8c9638227fc201d9 (diff) | |
download | vboot-4b31e1a9b02cb0eaca01491888cf40b8f7023545.tar.gz |
2api: Adjust the order of checking dev switch in vb2api_fw_phase1stabilize-14238.B
This CL is a revert to CL:300621.
In that CL, we adjusted the order of checking dev switch
(vb2_check_dev_switch) and move it after the check for recovery step
(vb2_check_recovery). The reason of that adjustment was because
vb2_check_dev_switch might return very early if the TPM is broken and
it failed to retrieve the secdata.
However, retrieving the secdata becomes a function which cannot fail
nowadays and it is not necessary to handle that scenario of the early
return in vb2_check_dev_switch. So we adjust them back to the original
order.
We also remove the related outdated unit tests in vb2_api_tests.c
BUG=none
BRANCH=none
TEST=CC=x86_64-pc-linux-gnu-clang;
make clean && make runtests
Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org>
Change-Id: Iada8092e73ed9282242b1d67d101c836860e13c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3168437
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/2lib/2api.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/firmware/2lib/2api.c b/firmware/2lib/2api.c index aa1d25da..593a12cf 100644 --- a/firmware/2lib/2api.c +++ b/firmware/2lib/2api.c @@ -59,6 +59,11 @@ vb2_error_t vb2api_fw_phase1(struct vb2_context *ctx) if (rv) vb2api_fail(ctx, VB2_RECOVERY_GBB_HEADER, rv); + /* Check for dev switch */ + rv = vb2_check_dev_switch(ctx); + if (rv) + vb2api_fail(ctx, VB2_RECOVERY_DEV_SWITCH, rv); + /* * Check for recovery. Note that this function returns void, since any * errors result in requesting recovery. That's also why we don't @@ -67,20 +72,6 @@ vb2_error_t vb2api_fw_phase1(struct vb2_context *ctx) */ vb2_check_recovery(ctx); - /* Check for dev switch */ - rv = vb2_check_dev_switch(ctx); - if (rv && !(ctx->flags & VB2_CONTEXT_RECOVERY_MODE)) { - /* - * Error in dev switch processing, and we weren't already - * headed for recovery mode. Reboot into recovery mode, since - * it's too late to handle those errors this boot, and we need - * to take a different path through the dev switch checking - * code in that case. - */ - vb2api_fail(ctx, VB2_RECOVERY_DEV_SWITCH, rv); - return rv; - } - /* * Check for possible reasons to ask the firmware to make display * available. VB2_CONTEXT_RECOVERY_MODE may have been set above by |