msm: camera: reqmgr: reader writer locks to avoid memory faults

Shared memory is initialized by CRM and used by
other drivers; with CRM not active other drivers
would fail to access the shared memory if
memory manager is deinit. Reader Writer locks can
prevent the open/close/ioctl calls from other drivers
if CRM open/close is already being processed.

Issue observed with the below sequence if drivers
are opened from UMD directly without this change.
CRM Open successful,ICP open successful,
CRM close in progress, ICP open successful,
mem mgr deinit and CRM close successful,
ICP tries to access HFI memory and result in crash.

This change helps to serialze the calls and prevents
issue.

CRs-Fixed: 3019488
Change-Id: I84d50918713686a067c0e3deb64c9c6ae9edfcb5
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
Esse commit está contido em:
Tejas Prajapati
2021-11-18 17:07:47 +05:30
commit de Camera Software Integration
commit 2827395809
16 arquivos alterados com 109 adições e 0 exclusões

Ver arquivo

@@ -85,6 +85,8 @@ static int cam_ope_subdev_open(struct v4l2_subdev *sd,
struct cam_node *node = v4l2_get_subdevdata(sd);
int rc = 0;
cam_req_mgr_rwsem_read_op(CAM_SUBDEV_LOCK);
mutex_lock(&g_ope_dev.ope_lock);
if (g_ope_dev.open_cnt >= 1) {
CAM_ERR(CAM_OPE, "OPE subdev is already opened");
@@ -108,6 +110,7 @@ static int cam_ope_subdev_open(struct v4l2_subdev *sd,
CAM_DBG(CAM_OPE, "OPE HW open success: %d", rc);
end:
mutex_unlock(&g_ope_dev.ope_lock);
cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);
return rc;
}