From f6877997980a1a594d495457cee2dac91f6a5534 Mon Sep 17 00:00:00 2001 From: Fernando Lugo Date: Thu, 12 Apr 2018 12:48:26 -0700 Subject: 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 --- boot_control.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3