From ac9f33ceac0d41df06b39480a36390793479c6c2 Mon Sep 17 00:00:00 2001 From: Padmanabha V Date: Wed, 16 Mar 2022 08:22:35 +0530 Subject: [PATCH] Rectify Boottime property __mount gets called multiple times. Set the read-only property only upon success since it can't be set multiple times. Selinux disallows modifying read-only property and therefore the property holds a wrong value, the one when __mount was called first even in case the call failed. Bug: 224824099 Signed-off-by: Padmanabha V Change-Id: If2900fcf988b6225bb0f96586b00b97386ca8a81 --- fs_mgr/fs_mgr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 686389495..d13f4d1a3 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -840,8 +840,10 @@ static int __mount(const std::string& source, const std::string& target, const F if ((ret == 0) && (mountflags & MS_RDONLY) != 0) { fs_mgr_set_blk_ro(source); } - android::base::SetProperty("ro.boottime.init.mount." + Basename(target), - std::to_string(t.duration().count())); + if (ret == 0) { + android::base::SetProperty("ro.boottime.init.mount." + Basename(target), + std::to_string(t.duration().count())); + } errno = save_errno; return ret; }