sdm: Acquire lock during hwcomposer module open and close
Protect the shared resources of hwcsession which is being accessed
from binder threads before its creation.
Change-Id: I1db0c71aa759f4430608d24541e06aedab04e14d
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index f938f0d..b755ab8 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -187,6 +187,8 @@
}
int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) {
+ SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+
if (!module || !name || !device) {
DLOGE("Invalid parameters.");
return -EINVAL;
@@ -212,6 +214,8 @@
}
int HWCSession::Close(hw_device_t *device) {
+ SEQUENCE_WAIT_SCOPE_LOCK(locker_);
+
if (!device) {
return -EINVAL;
}