diff options
| author | Fernando Lugo <flugo@google.com> | 2018-04-12 12:48:26 -0700 |
|---|---|---|
| committer | Fernando Lugo <flugo@google.com> | 2018-04-12 13:01:58 -0700 |
| commit | f6877997980a1a594d495457cee2dac91f6a5534 (patch) | |
| tree | 61942ca22e03e502cf97b3196f8366efbcf20c1d | |
| parent | ea07592c30a87d555049d70807b09f9b7151cf2e (diff) | |
| download | android_hardware_qcom_bootctrl-f6877997980a1a594d495457cee2dac91f6a5534.tar.gz android_hardware_qcom_bootctrl-f6877997980a1a594d495457cee2dac91f6a5534.tar.bz2 android_hardware_qcom_bootctrl-f6877997980a1a594d495457cee2dac91f6a5534.zip | |
bootcontrol: return error if set active for partitions fails
Do not continue in case of an error setting active slot for all
partitions. Otherwise, boot LUN will be changed causing XBL to be read
from the new slot but other parts of the bootloader will be read from
old slot. This may cause the bootloader to crash and device will be
bricked
Bug: 77969086
Test: bootctl set-active-boot-slot 0
Change-Id: Ief029f314d3b1197e43b6e85ac78aba9761cf736
Signed-off-by: Fernando Lugo <flugo@google.com>
| -rw-r--r-- | boot_control.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/boot_control.cpp b/boot_control.cpp index 947e0d5..e8a6421 100644 --- a/boot_control.cpp +++ b/boot_control.cpp @@ -562,7 +562,10 @@ int set_active_boot_slot(struct boot_control_module *module, unsigned slot) for (map_iter = ptn_map.begin(); map_iter != ptn_map.end(); map_iter++){ if (map_iter->second.size() < 1) continue; - boot_ctl_set_active_slot_for_partitions(map_iter->second, slot); + if (boot_ctl_set_active_slot_for_partitions(map_iter->second, slot)) { + ALOGE("%s: Failed to set active slot for partitions ", __func__);; + goto error; + } } if (is_ufs) { if (!strncmp(slot_suffix_arr[slot], AB_SLOT_A_SUFFIX, |
