summaryrefslogtreecommitdiffstats
path: root/src/security
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2023-02-17 17:08:17 +0100
committerEric Lai <eric_lai@quanta.corp-partner.google.com>2023-02-21 01:36:50 +0000
commit5f9dafe5ff66cb2b4ce3944ec91123274f6e623e (patch)
treee961333826c2cf000aeef6a8f9614acceae54b73 /src/security
parent03fbf06ffd80e880b15e40f08f14a287662c91bf (diff)
downloadcoreboot-5f9dafe5ff66cb2b4ce3944ec91123274f6e623e.tar.gz
coreboot-5f9dafe5ff66cb2b4ce3944ec91123274f6e623e.tar.bz2
coreboot-5f9dafe5ff66cb2b4ce3944ec91123274f6e623e.zip
vboot: Fix reboot loop in recovery with VBOOT_CBFS_INTEGRATION
After first recovery request coreboot would get stuck in bootloop with VB2_RECOVERY_PREAMBLE as recovery reason due to not checking whether coreboot is alread in recovery mode, and calling failing code. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Idc947a1d150ff6487cf973b36bf4f0af41daa220 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73091 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/security')
-rw-r--r--src/security/vboot/vboot_loader.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/security/vboot/vboot_loader.c b/src/security/vboot/vboot_loader.c
index 7cda690216b3..70e66858e98a 100644
--- a/src/security/vboot/vboot_loader.c
+++ b/src/security/vboot/vboot_loader.c
@@ -31,6 +31,12 @@ static void after_verstage(void)
struct vb2_hash *metadata_hash = NULL;
struct vb2_context *ctx = NULL;
+ vboot_executed = 1; /* Mark verstage execution complete. */
+
+ const struct cbfs_boot_device *cbd = vboot_get_cbfs_boot_device();
+ if (!cbd) /* Can't initialize RW CBFS in recovery mode. */
+ return;
+
if (CONFIG(VBOOT_CBFS_INTEGRATION)) {
ctx = vboot_get_context();
vb2_error_t rv = vb2api_get_metadata_hash(ctx, &metadata_hash);
@@ -38,12 +44,6 @@ static void after_verstage(void)
vboot_fail_and_reboot(ctx, VB2_RECOVERY_FW_PREAMBLE, rv);
}
- vboot_executed = 1; /* Mark verstage execution complete. */
-
- const struct cbfs_boot_device *cbd = vboot_get_cbfs_boot_device();
- if (!cbd) /* Can't initialize RW CBFS in recovery mode. */
- return;
-
enum cb_err err = cbfs_init_boot_device(cbd, metadata_hash);
if (err && err != CB_CBFS_CACHE_FULL) {
if (CONFIG(VBOOT_CBFS_INTEGRATION)) {