summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdy Abraham <adyabr@google.com>2019-10-18 14:17:23 -0700
committerAdy Abraham <adyabr@google.com>2019-11-15 13:50:26 -0800
commitabf9106001addb6aea15c681ae8c2cc347fc93bd (patch)
tree0e8ebf6e409f8af6680a4ece69f3eedafe86c73b
parente33b0ef0c84ccb99ca23c60a679b318aef078bb5 (diff)
downloadnative-abf9106001addb6aea15c681ae8c2cc347fc93bd.tar.gz
SurfaceFlinger: lock mStateLock when modifying allowed configs
mAllowedDisplayConfigs should be protected by mStateLock when changing it from the main thread in setAllowedDisplayConfigsInternal() as it is being read by Binder threads in getAllowedDisplayConfigs(). Test: call setAllowedDisplayConfigs() and getAllowedDisplayConfigs() from backdoor using different threads. Bug: 142850581 Change-Id: I569e75968aea676c96fbc648140ac49a165ffb69 Merged-In: I569e75968aea676c96fbc648140ac49a165ffb69
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 23b399f838..9efa63ce33 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6242,7 +6242,7 @@ status_t SurfaceFlinger::setAllowedDisplayConfigs(const sp<IBinder>& displayToke
return NO_ERROR;
}
- postMessageSync(new LambdaMessage([&]() NO_THREAD_SAFETY_ANALYSIS {
+ postMessageSync(new LambdaMessage([&]() {
const auto display = getDisplayDeviceLocked(displayToken);
if (!display) {
ALOGE("Attempt to set allowed display configs for invalid display token %p",
@@ -6250,6 +6250,7 @@ status_t SurfaceFlinger::setAllowedDisplayConfigs(const sp<IBinder>& displayToke
} else if (display->isVirtual()) {
ALOGW("Attempt to set allowed display configs for virtual display");
} else {
+ Mutex::Autolock lock(mStateLock);
setAllowedDisplayConfigsInternal(display, allowedConfigs);
}
}));