mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
msm: camera: icp: Protect icp context access at time of pagefault
Take mutex before acessing icp context to prevent improper free. Change-Id: If2fd2c66dd9a00f1ab5c9ec1710573c2921dce6a Signed-off-by: Prakasha Nayak <pnayak@codeaurora.org>
This commit is contained in:
parent
2c55550c19
commit
657d77d87d
1 changed files with 10 additions and 0 deletions
|
|
@ -37,6 +37,14 @@ static int cam_icp_context_dump_active_request(void *data, unsigned long iova,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&ctx->ctx_mutex);
|
||||
|
||||
if (ctx->state < CAM_CTX_ACQUIRED || ctx->state > CAM_CTX_ACTIVATED) {
|
||||
CAM_ERR(CAM_ICP, "Invalid state icp ctx %d state %d",
|
||||
ctx->ctx_id, ctx->state);
|
||||
goto end;
|
||||
}
|
||||
|
||||
CAM_INFO(CAM_ICP, "iommu fault for icp ctx %d state %d",
|
||||
ctx->ctx_id, ctx->state);
|
||||
|
||||
|
|
@ -55,6 +63,8 @@ static int cam_icp_context_dump_active_request(void *data, unsigned long iova,
|
|||
req->request_id, rc);
|
||||
}
|
||||
|
||||
end:
|
||||
mutex_unlock(&ctx->ctx_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue