diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2023-10-30 16:45:32 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-11-13 14:20:30 +0000 |
commit | 4f1dda7447025e42b73a31307db94c69fa5d277e (patch) | |
tree | 45143942147206bcd52398405a63f90c2c33b084 /src/device/xhci_resource.c | |
parent | f52367a907d5ea27c83593611bf2a38b7b7ba764 (diff) |
security/vboot: Die if vb2api_reinit() failed
In vboot_get_context(), vb2api_reinit() is called to restore the vboot
context from the previous stage. We use assert() for the return value of
vb2api_reinit() because there shouldn't be runtime errors, except for
one edge case: vb2_shared_data struct version mismatch. More precisely,
when RW firmware's VB2_SHARED_DATA_VERSION_MINOR is greater than RO's,
vb2api_reinit() will return VB2_ERROR_SHARED_DATA_VERSION.
To avoid using an invalid vb2_context pointer (when FATAL_ASSERTS is
disabled), change assert() to die() on vb2api_reinit() failure. For the
vb2api_init() case the assertion is unchanged because there shouldn't be
any runtime error for that.
Also move the vb2api_init() call outside the assert() argument, as
assert() may be a no-op macro depending on the implementation.
Change-Id: I4ff5ef1202bba2384c71634ec5ba12db1b784607
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78808
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/device/xhci_resource.c')
0 files changed, 0 insertions, 0 deletions