msm: camera: sync: Protect sync destroy against race condition

Take the lock before checking state in cam_sync_destroy() and hold the
lock until the end of cam_sync_destroy() to avoid race condition
between checking of state and setting of state. Also delete the
callback info from list before issuing the callback to further avoid
race condition between issuing callback and freeing cb_info in
cam_sync_deinit_object.

Change-Id: I1835dc1a868d5cb5ef7b517dbc2f227f7930726a
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2 files changed