Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 345ff8c6 authored by Vikram Sharma's avatar Vikram Sharma Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: ope: Handle race while dumping ope req list



While dumping OPE req list we were not protecting it in context mutex,
this can result into unexpected behaviors. This change take care of
protecting the dump logic using mutex.

CRs-Fixed: 2750458
Change-Id: I916822b498cde3922274c18a06b98c898bff1d65
Signed-off-by: default avatarVikram Sharma <vikramsa@codeaurora.org>
parent 6357d070
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@

static struct cam_ope_hw_mgr *ope_hw_mgr;

static int cam_ope_req_timer_reset(struct cam_ope_ctx *ctx_data);

static int cam_ope_mgr_get_rsc_idx(struct cam_ope_ctx *ctx_data,
	struct ope_io_buf_info *in_io_buf)
{
@@ -125,6 +127,8 @@ static int cam_ope_mgr_process_cmd(void *priv, void *data)
	if (task_data->req_id > ctx_data->last_flush_req)
		ctx_data->last_flush_req = 0;

	cam_ope_req_timer_reset(ctx_data);

	rc = cam_cdm_submit_bls(ctx_data->ope_cdm.cdm_handle, cdm_cmd);

	if (!rc)
@@ -3639,6 +3643,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
	}

	mutex_lock(&hw_mgr->hw_mgr_mutex);
	mutex_lock(&ctx_data->ctx_mutex);

	CAM_INFO(CAM_OPE, "Req %lld", dump_args->request_id);
	for (idx = 0; idx < CAM_CTX_REQ_MAX; idx++) {
@@ -3652,6 +3657,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)

	/* no matching request found */
	if (idx == CAM_CTX_REQ_MAX) {
		mutex_unlock(&ctx_data->ctx_mutex);
		mutex_unlock(&hw_mgr->hw_mgr_mutex);
		return 0;
	}
@@ -3669,6 +3675,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
			req_ts.tv_nsec/NSEC_PER_USEC,
			cur_ts.tv_sec,
			cur_ts.tv_nsec/NSEC_PER_USEC);
		mutex_unlock(&ctx_data->ctx_mutex);
		mutex_unlock(&hw_mgr->hw_mgr_mutex);
		return 0;
	}
@@ -3680,6 +3687,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
		cur_ts.tv_sec,
		cur_ts.tv_nsec/NSEC_PER_USEC);

	mutex_unlock(&ctx_data->ctx_mutex);
	mutex_unlock(&hw_mgr->hw_mgr_mutex);
	return 0;
}