msm: vidc: Fix a race condition during session init
msm_comm_session_init calls hfi session_init function, which allocates
session memory, sends session_init command to firmware and returns
the session pointer. This gets stored in inst->session. When firmware
returns the session_init_done, in the callback function, we process
the message only if inst->session is valid.
Consider the case of forward thread being scheduled out after sending
session_init command to firmware, but before storing session pointer
in inst->session. In the mean time firmware has returned session_init_done,
which is received by driver, but we reject the message saying invalid
session, since inst->session is still NULL. This will cause driver to
time out waiting on session_init_done and fail the session.
This change ensures that the above race condition is avoided.
Change-Id: Ib0e916dd036ba42cb03602be9ef77e49fdcd8193
Signed-off-by:
Arun Menon <avmenon@codeaurora.org>
Loading
Please register or sign in to comment