diff --git a/KeyStorage.cpp b/KeyStorage.cpp index 84dd8ec..6fc7250 100644 --- a/KeyStorage.cpp +++ b/KeyStorage.cpp @@ -223,6 +223,10 @@ static KeymasterOperation begin(Keymaster& keymaster, const std::string& dir, PLOG(ERROR) << "Unable to move upgraded key to location: " << kmKeyPath; return KeymasterOperation(); } + if (!android::vold::FsyncDirectory(dir)) { + LOG(ERROR) << "Key dir sync failed: " << dir; + return KeymasterOperation(); + } if (!keymaster.deleteKey(kmKey)) { LOG(ERROR) << "Key deletion failed during upgrade, continuing anyway: " << dir; }