summaryrefslogtreecommitdiff
path: root/interfaces
diff options
context:
space:
mode:
authorOleg Matcovschi <omatcovschi@google.com>2021-08-20 00:43:31 -0700
committerFernando Lugo <flugo@google.com>2023-01-06 14:52:47 -0800
commit8b9ae264d8d37074e61d72bd381b195a1a11221b (patch)
treeba6d07d19c7befa9e69e14191b6ca3da2aef7f09 /interfaces
parent9b1235529aa06f2a791e8a4ad554c3c7423dea36 (diff)
downloadgs201-8b9ae264d8d37074e61d72bd381b195a1a11221b.tar.gz
bootctrl: enforce synchronous write operation
Bug: 263218204 Bug: 197104397 Signed-off-by: Oleg Matcovschi <omatcovschi@google.com> Change-Id: Ifbc612fc40847395ccb751463b1bb15bd3f20657 (cherry picked from commit 354f3c6d2edf302b030ed698bac4c0fd8067f0f4)
Diffstat (limited to 'interfaces')
-rw-r--r--interfaces/boot/1.2/BootControl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/interfaces/boot/1.2/BootControl.cpp b/interfaces/boot/1.2/BootControl.cpp
index 70b9594..a28be05 100644
--- a/interfaces/boot/1.2/BootControl.cpp
+++ b/interfaces/boot/1.2/BootControl.cpp
@@ -162,7 +162,7 @@ static bool DevInfoSync() {
return false;
}
- android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY));
+ android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY | O_DSYNC));
return android::base::WriteFully(fd, &devinfo, sizeof devinfo);
}
@@ -270,13 +270,13 @@ Return<void> BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb
std::string boot_lun_path =
std::string("/sys/devices/platform/") + boot_dev + "/pixel/boot_lun_enabled";
- int fd = open(boot_lun_path.c_str(), O_RDWR);
+ int fd = open(boot_lun_path.c_str(), O_RDWR | O_DSYNC);
if (fd < 0) {
// Try old path for kernels < 5.4
// TODO: remove once kernel 4.19 support is deprecated
std::string boot_lun_path =
std::string("/sys/devices/platform/") + boot_dev + "/attributes/boot_lun_enabled";
- fd = open(boot_lun_path.c_str(), O_RDWR);
+ fd = open(boot_lun_path.c_str(), O_RDWR | O_DSYNC);
if (fd < 0) {
_hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
return Void();