diff options
author | Tyler Luu <tluu@ti.com> | 2011-08-30 10:06:39 +0300 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-08-31 20:02:33 -0700 |
commit | d55379a7e975f992db1d10bba425f456447d14a8 (patch) | |
tree | 5864eb4c10d22de853691b153495475c38eed410 /camera/OMXCameraAdapter/OMX3A.cpp | |
parent | 3a1541be51a8cc8dcc92a4ea1f0fa4a1c80990ce (diff) | |
download | omap4xxx-d55379a7e975f992db1d10bba425f456447d14a8.tar.gz |
CameraHAL: Adds locking when accessing 'mFocusAreas'
- This is due to the access pattern of 'mFocusAreas.
Currently both 'setFocusMode()' and
'setParametersFocus()' can in parallel try to
write/read from this Vector. A race condition is
possible, in which the former method can clear a
focus area, while the latter method is trying to
increment its strong pointer. This will inevitably
result in a segfault.
Change-Id: I0e94d18326b85c20f73296d31d980b9c39685c32
Original-author: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Tyler Luu <tluu@ti.com>
Diffstat (limited to 'camera/OMXCameraAdapter/OMX3A.cpp')
-rw-r--r-- | camera/OMXCameraAdapter/OMX3A.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp index 647c7a7..54e8b8f 100644 --- a/camera/OMXCameraAdapter/OMX3A.cpp +++ b/camera/OMXCameraAdapter/OMX3A.cpp @@ -396,11 +396,14 @@ status_t OMXCameraAdapter::setFocusMode(Gen3A_settings& Gen3A) return NO_INIT; } - if ( !mFocusAreas.isEmpty() ) { - focusArea = mFocusAreas.itemAt(0); - } + Mutex::Autolock lock(mFocusAreasLock); + if ( !mFocusAreas.isEmpty() ) + { + focusArea = mFocusAreas.itemAt(0); + } + } ///Face detection takes precedence over touch AF if ( mFaceDetectionRunning ) |