diff options
author | Zhijun He <zhijunhe@google.com> | 2014-08-27 15:50:25 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2014-08-27 16:40:21 -0700 |
commit | 5487fd54f344c422be089217e62098545704bb03 (patch) | |
tree | a99375f14d96c32aa7c190add48a8ab11fe2a8b7 /services/camera | |
parent | 9dd4a2ddd7caf8cbe50d8a76e0ec3e0274d2bce6 (diff) | |
download | frameworks_av-5487fd54f344c422be089217e62098545704bb03.zip frameworks_av-5487fd54f344c422be089217e62098545704bb03.tar.gz frameworks_av-5487fd54f344c422be089217e62098545704bb03.tar.bz2 |
Camera API1: Fix ZSLProcessor3 deadlock
ZSLProcessor3 shouldn't acquire mInputMutex in onBufferReleased call for output
buffers, because the caller (Camera3Stream::returnBuffer) holds the camera3
stream lock already. This could cause deadlock for ZSL reprocess request as it
holds the ZSLProcessor3 input lock and try to acquire camera3 stream lock to
submit the request.
Bug: 17299038
Change-Id: I6a7bf8ebd7c2064852358c655f3a3e9a67769213
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp index b388079..3999047 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp @@ -554,13 +554,15 @@ void ZslProcessor3::onBufferAcquired(const BufferInfo& /*bufferInfo*/) { } void ZslProcessor3::onBufferReleased(const BufferInfo& bufferInfo) { - Mutex::Autolock l(mInputMutex); // ignore output buffers if (bufferInfo.mOutput) { return; } + // Lock mutex only once we know this is an input buffer returned to avoid + // potential deadlock + Mutex::Autolock l(mInputMutex); // TODO: Verify that the buffer is in our queue by looking at timestamp // theoretically unnecessary unless we change the following assumptions: // -- only 1 buffer reprocessed at a time (which is the case now) |