mm-video-v4l2: venc: Protect buffer from being freed while accessing

Output buffer (in use-buffer mode) has an internal backup ion buffer.
The contents of this buffer are deep-copied in client's buffer in
the context of VideoEncCallBackThread; while this buffer can be
freed in the client thread's context.
Check the allocation bitmask before attempting to copy and
synchronize these operations by holding a lock

Fixes bug 36130225
 Security Vulnerability - Heap use after free in libOmxVenc

CRs-Fixed: 2053101

Bug: 36130225
Change-Id: I75ef3df29fcabff52ea87cf5a4aa98e48bb40298
Author: Praveen Chavan<pchavan@codeaurora.org>
(cherry picked from commit f56db36a42e50bfca7dd0e8d80cee8233daf61d2)
3 files changed
tree: 127e08d12197dede8caed46163e90766ee73c068
  1. Android.mk
  2. CleanSpec.mk
  3. msm8974/
  4. msm8996/
  5. msm8998/