diff options
author | susi_su <susisu@google.com> | 2022-06-23 23:49:36 +0800 |
---|---|---|
committer | Susi Su <susisu@google.com> | 2022-06-24 13:30:48 +0000 |
commit | 22bcb0b86f815534550b90390aecea156d76bc3a (patch) | |
tree | 6a5b456475f7bd23db87934bff02b1c3e101a0df /libhwc2.1/histogram_mediator.cpp | |
parent | 33c0adb6acf9f282bdd2ad03497f81d036e32d02 (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.cpp | 3 |
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; } } |