Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
msm: vidc: Handle race condition for accessing session head
Browse files Browse the repository at this point in the history
During CVP internal session, CVP close done calls for session
clean. session_clean API acquires the device lock and destroys
the cvp hal_session. At the same time, if decoder session is
also in the verge of close, since session_end does not have a
device lock, there is high chance to access corrupted hal_session
values.

Change-Id: I34593e6507da9bad13c6d92faf40c4d790825d39
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
  • Loading branch information
Priyanka Gujjula committed Aug 4, 2020
1 parent 0422bd4 commit a06876a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions msm/vidc/hfi_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2371,18 +2371,20 @@ static int venus_hfi_session_end(void *sess)
struct venus_hfi_device *device = &venus_hfi_dev;
int rc = 0;

if (!__is_session_valid(device, session, __func__))
return -EINVAL;

mutex_lock(&device->lock);
if (!__is_session_valid(device, session, __func__)) {
rc = -EINVAL;
goto exit;
}

if (msm_vidc_fw_coverage) {
if (__sys_set_coverage(device, msm_vidc_fw_coverage,
session->sid))
s_vpr_e(session->sid, "Fw_coverage msg ON failed\n");
}
rc = __send_session_cmd(session, HFI_CMD_SYS_SESSION_END);
exit:
mutex_unlock(&device->lock);

return rc;
}

Expand Down

0 comments on commit a06876a

Please sign in to comment.