summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeng-Huan Yu <menghuan@chromium.org>2021-01-12 19:35:09 +0800
committerCommit Bot <commit-bot@chromium.org>2021-02-20 00:33:00 +0000
commita249e31bd76a8eb2f5eb702b6b4224bdec871974 (patch)
treee5691f3bec9198176640aee621ea54db87b1188e
parente4f8b0decad7c1f5016d5476f4b4ee23ac8c000d (diff)
downloadvboot-a249e31bd76a8eb2f5eb702b6b4224bdec871974.tar.gz
Minidiag: Commit NVRAM immediately right after cleaning diag request
Clean up the diag request flag to avoid potential reboot loop if somehow a forced reboot occurs. BRANCH=puff,zork,volteer,trogdor,dedede BUG=b:177303714 TEST=CQ TEST=FEATURES=test P2_TEST_FILTER='*' emerge-zork vboot_reference TEST=boot to minidiag and then do hardware reset, then expect boot to OS instead of boot to minidiag again. Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I24815d512ca42b78dc42cafaebc666e6a53db793 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2624110 Reviewed-by: Joel Kitching <kitching@chromium.org> (cherry picked from commit 5046e96cfa81350e53ffc4ac0f87e1b5f9c6eee1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2677617 Reviewed-by: Henry Sun <henrysun@google.com> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
-rw-r--r--firmware/lib/vboot_api_kernel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index a910b552..971abc66 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -242,7 +242,13 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx,
}
} else if (DIAGNOSTIC_UI && vb2api_diagnostic_ui_enabled(ctx) &&
vb2_nv_get(ctx, VB2_NV_DIAG_REQUEST)) {
+ /*
+ * Need to clear the request flag and commit nvdata changes
+ * immediately to avoid booting back into diagnostic tool when a
+ * forced system reset occurs.
+ */
vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0);
+ vb2ex_commit_data(ctx);
/* Diagnostic boot. This has UI. */
if (MENU_UI)