diff options
author | Bowgo Tsai <bowgotsai@google.com> | 2017-11-09 22:26:04 +0800 |
---|---|---|
committer | Bowgo Tsai <bowgotsai@google.com> | 2017-11-10 12:53:46 +0800 |
commit | ec19cf6306e66ef8e3e696e5495cd3bd3487d414 (patch) | |
tree | e3a24dd9011be1a59597732bf6d433e7cb8a15aa | |
parent | ebcfa449375fb809b266383d0036a7be3ecdac01 (diff) | |
download | system_core-ec19cf6306e66ef8e3e696e5495cd3bd3487d414.tar.gz system_core-ec19cf6306e66ef8e3e696e5495cd3bd3487d414.tar.bz2 system_core-ec19cf6306e66ef8e3e696e5495cd3bd3487d414.zip |
first stage mount: abort when failed to parse fstab in device-tree
The client of FirstStageMount class should check the existence of fstab
in device-tree prior to using it. So raising a FATAL error inside
FirstStageMount when failed to parsing the fstab, in order to expose
more accurate error messages.
Also fixing a comment in fs_mgr, where it might happen in either
non-A/B or A/B.
Bug: 69102431
Test: boot sailfish
Change-Id: Ifb525beaa3423b118644778bfe0f84bff9465303
-rw-r--r-- | fs_mgr/fs_mgr_slotselect.cpp | 2 | ||||
-rw-r--r-- | init/init_first_stage.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/fs_mgr/fs_mgr_slotselect.cpp b/fs_mgr/fs_mgr_slotselect.cpp index 33fd56240..0a113b47e 100644 --- a/fs_mgr/fs_mgr_slotselect.cpp +++ b/fs_mgr/fs_mgr_slotselect.cpp @@ -40,7 +40,7 @@ bool fs_mgr_update_for_slotselect(struct fstab *fstab) { char *tmp; if (ab_suffix.empty()) { ab_suffix = fs_mgr_get_slot_suffix(); - // Returns false as non A/B devices should not have MF_SLOTSELECT. + // Return false if failed to get ab_suffix when MF_SLOTSELECT is specified. if (ab_suffix.empty()) return false; } if (asprintf(&tmp, "%s%s", fstab->recs[n].blk_device, ab_suffix.c_str()) > 0) { diff --git a/init/init_first_stage.cpp b/init/init_first_stage.cpp index 0f7e38fa6..6fa07e728 100644 --- a/init/init_first_stage.cpp +++ b/init/init_first_stage.cpp @@ -118,7 +118,10 @@ static bool inline IsRecoveryMode() { FirstStageMount::FirstStageMount() : need_dm_verity_(false), device_tree_fstab_(fs_mgr_read_fstab_dt(), fs_mgr_free_fstab) { if (!device_tree_fstab_) { - LOG(ERROR) << "Failed to read fstab from device tree"; + // The client of FirstStageMount should check the existence of fstab in device-tree + // in advance, without parsing it. Reaching here means there is a FATAL error when + // parsing the fstab. So stop here to expose the failure. + LOG(FATAL) << "Failed to read fstab from device tree"; return; } // Stores device_tree_fstab_->recs[] into mount_fstab_recs_ (vector<fstab_rec*>) |