summaryrefslogtreecommitdiff
path: root/libhwc2.1/histogram_mediator.cpp
diff options
context:
space:
mode:
authorsusi_su <susisu@google.com>2022-06-23 23:49:36 +0800
committerSusi Su <susisu@google.com>2022-06-24 13:30:48 +0000
commit22bcb0b86f815534550b90390aecea156d76bc3a (patch)
tree6a5b456475f7bd23db87934bff02b1c3e101a0df /libhwc2.1/histogram_mediator.cpp
parent33c0adb6acf9f282bdd2ad03497f81d036e32d02 (diff)
libhwc2.1: fix crash caused by secure layer check
1. add lock when executing secure layer check 2. check NULL before layer->isDrm() call Bug: 236678977 Test: create a reproducible scenario(loop 5M times isSecureContentPresenting()) and verify it Change-Id: I836e39b0b75e3c7c94dd8ffe03686e976d3d0f91
Diffstat (limited to 'libhwc2.1/histogram_mediator.cpp')
-rw-r--r--libhwc2.1/histogram_mediator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libhwc2.1/histogram_mediator.cpp b/libhwc2.1/histogram_mediator.cpp
index 204c350..8f39812 100644
--- a/libhwc2.1/histogram_mediator.cpp
+++ b/libhwc2.1/histogram_mediator.cpp
@@ -38,9 +38,10 @@ bool histogram::HistogramMediator::isDisplayPowerOff() {
}
bool histogram::HistogramMediator::isSecureContentPresenting() {
+ Mutex::Autolock lock(mDisplay->mDRMutex);
for (uint32_t i = 0; i < mDisplay->mLayers.size(); i++) {
ExynosLayer *layer = mDisplay->mLayers[i];
- if (layer->isDrm()) { /* there is some DRM layer */
+ if (layer != NULL && layer->isDrm()) { /* there is some DRM layer */
return true;
}
}