msm: camera: reqmgr: Assign proper init value to min delay

The apply_data can be accessed by DELAY_MAX if min delay
is initial value, it will cause out of array bound issue.
This change assign DELAY_2 to the min delay, DELAY_2 is a
value array index to apply_data.

CRs-Fixed: 3244492
Change-Id: I16e73e562488058cea68c76c1aaa9dcfeb0c2d9a
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
This commit is contained in:
Depeng Shao
2022-07-15 10:40:02 +08:00
committed by Camera Software Integration
parent 7ebdf41ae9
commit 1067cc03bd

View File

@@ -39,7 +39,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
link->link_hdl = 0;
link->num_devs = 0;
link->max_delay = CAM_PIPELINE_DELAY_0;
link->min_delay = CAM_PIPELINE_DELAY_MAX;
link->min_delay = CAM_PIPELINE_DELAY_2;
link->workq = NULL;
link->pd_mask = 0;
link->l_dev = NULL;
@@ -447,6 +447,12 @@ static int __cam_req_mgr_notify_error_on_link(
return -EINVAL;
}
if (link->min_delay >= CAM_PIPELINE_DELAY_MAX) {
CAM_ERR(CAM_CRM, "min pd : %d is more than expected",
link->min_delay);
return -EINVAL;
}
/* Notify all devices in the link about the error */
__cam_req_mgr_send_evt(link->req.apply_data[link->min_delay].req_id,
CAM_REQ_MGR_LINK_EVT_STALLED, CRM_KMD_ERR_FATAL, link);
@@ -2517,7 +2523,7 @@ static void __cam_req_mgr_destroy_link_info(struct cam_req_mgr_core_link *link)
link->pd_mask = 0;
link->num_devs = 0;
link->max_delay = CAM_PIPELINE_DELAY_0;
link->min_delay = CAM_PIPELINE_DELAY_MAX;
link->min_delay = CAM_PIPELINE_DELAY_2;
}
/**
@@ -2566,8 +2572,8 @@ static struct cam_req_mgr_core_link *__cam_req_mgr_reserve_link(
mutex_lock(&link->lock);
link->num_devs = 0;
link->max_delay = 0;
link->min_delay = CAM_PIPELINE_DELAY_MAX;
link->max_delay = CAM_PIPELINE_DELAY_0;
link->min_delay = CAM_PIPELINE_DELAY_2;
memset(in_q->slot, 0,
sizeof(struct cam_req_mgr_slot) * MAX_REQ_SLOTS);
link->req.in_q = in_q;