diff options
author | Hung-Te Lin <hungte@chromium.org> | 2022-01-20 20:05:43 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-08 23:26:56 +0000 |
commit | 2b1e932c2fb06d5631eb21014c5fe93883193ccd (patch) | |
tree | 40c7cdbdc6cc41ddc206c7976e0dda763e322fd1 | |
parent | fef4a4ae928dab75936ecef3f6eb9d29233c5107 (diff) | |
download | vboot-2b1e932c2fb06d5631eb21014c5fe93883193ccd.tar.gz |
futility: updater: prevent unexpected update for the RW_LEGACY section
When updating the legacy section, we have to check the existence of
'cros_allow_auto_update' in both 'from' and 'to' images, and only update
if they both have the correct tag file.
BUG=b:215175246,chromium:1169544
TEST=make; build and run test
BRANCH=None
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Change-Id: I81f62f42cf9a6f6f1931e05cd07131b569ad0cb0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3404063
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r-- | futility/updater.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/futility/updater.c b/futility/updater.c index 46f8878a..4d96d2f5 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -877,16 +877,18 @@ static int legacy_needs_update(struct updater_config *cfg) int has_from, has_to; const char * const tag = "cros_allow_auto_update"; const char *section = FMAP_RW_LEGACY; - const char *tmp_path; + const char *tmp_to, *tmp_from; VB2_DEBUG("Checking %s contents...\n", FMAP_RW_LEGACY); - tmp_path = get_firmware_image_temp_file(&cfg->image, &cfg->tempfiles); - if (!tmp_path) + tmp_to = get_firmware_image_temp_file(&cfg->image, &cfg->tempfiles); + tmp_from = get_firmware_image_temp_file(&cfg->image_current, + &cfg->tempfiles); + if (!tmp_from || !tmp_to) return 0; - has_to = cbfs_file_exists(tmp_path, section, tag); - has_from = cbfs_file_exists(tmp_path, section, tag); + has_to = cbfs_file_exists(tmp_to, section, tag); + has_from = cbfs_file_exists(tmp_from, section, tag); if (!has_from || !has_to) { VB2_DEBUG("Current legacy firmware has%s updater tag (%s) and " |