Snap for 6732909 from 140f65189fd2aaa43bc991556a9678a4ff981731 to rvc-d1-release
Change-Id: Ia5e1b9d82a16a99ac2e6cbb69462fb30b300b21a
diff --git a/services/gpuservice/GpuService.cpp b/services/gpuservice/GpuService.cpp
index 304f1d0..81b0a46 100644
--- a/services/gpuservice/GpuService.cpp
+++ b/services/gpuservice/GpuService.cpp
@@ -63,11 +63,23 @@
}
void GpuService::setUpdatableDriverPath(const std::string& driverPath) {
- developerDriverPath = driverPath;
+ IPCThreadState* ipc = IPCThreadState::self();
+ const int pid = ipc->getCallingPid();
+ const int uid = ipc->getCallingUid();
+
+ // only system_server is allowed to set updatable driver path
+ if (uid != AID_SYSTEM) {
+ ALOGE("Permission Denial: can't set updatable driver path from pid=%d, uid=%d\n", pid, uid);
+ return;
+ }
+
+ std::lock_guard<std::mutex> lock(mLock);
+ mDeveloperDriverPath = driverPath;
}
std::string GpuService::getUpdatableDriverPath() {
- return developerDriverPath;
+ std::lock_guard<std::mutex> lock(mLock);
+ return mDeveloperDriverPath;
}
status_t GpuService::shellCommand(int /*in*/, int out, int err, std::vector<String16>& args) {
diff --git a/services/gpuservice/GpuService.h b/services/gpuservice/GpuService.h
index ba44fe0..d1c3aab 100644
--- a/services/gpuservice/GpuService.h
+++ b/services/gpuservice/GpuService.h
@@ -75,7 +75,8 @@
* Attributes
*/
std::unique_ptr<GpuStats> mGpuStats;
- std::string developerDriverPath;
+ std::mutex mLock;
+ std::string mDeveloperDriverPath;
};
} // namespace android