diff options
| author | Sughosh Ganu <[email protected]> | 2024-09-09 16:50:20 +0530 |
|---|---|---|
| committer | Ilias Apalodimas <[email protected]> | 2024-09-19 10:52:50 +0300 |
| commit | be281eccb053c6d44bc8298024d5b7d637631c24 (patch) | |
| tree | ba42b82d7b6e6c65f10510db94154caec90165f1 /lib/fwu_updates | |
| parent | 1049dc7e918af23fa05cae2af3cf271a6eb119b2 (diff) | |
fwu: do not allow capsule processing on exceeding Trial Counter threshold
When in Trial State, the platform keeps a count of the number of times
it has booted in the Trial State. Once the threshold of the maximum
allowed count exceeds, the platform reverts to boot from a different
bank on subsequent boot, thus coming out of the Trial State. It is
expected that all the updated images would be accepted or rejected
while the platform is in Trial State. Put in checks so that it is not
possible to apply an empty capsule once the max Trial Count exceeds.
Signed-off-by: Sughosh Ganu <[email protected]>
Tested-by: Michal Simek <[email protected]>
Signed-off-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'lib/fwu_updates')
| -rw-r--r-- | lib/fwu_updates/fwu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index a94a769a2b6..7f085a0211f 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -113,6 +113,8 @@ static int fwu_trial_count_update(void) ret = fwu_revert_boot_index(); if (ret) log_err("Unable to revert active_index\n"); + + trial_counter_update(NULL); ret = 1; } else { log_info("Trial State count: attempt %d out of %d\n", @@ -762,8 +764,8 @@ static int fwu_boottime_checks(void) return 0; in_trial = in_trial_state(); - if (!in_trial || (ret = fwu_trial_count_update()) > 0) - ret = trial_counter_update(NULL); + + ret = in_trial ? fwu_trial_count_update() : trial_counter_update(NULL); if (!ret) boottime_check = 1; |
