Эх сурвалжийг харах

msm: camera: reqmgr: Fix the crm driver

Add a check in the request manager code
to prevent the possible out of bound
array access.

CRs-Fixed: 3051099
Change-Id: I4b4ec5778d83aa8993225cae0cd599a02f526082
Signed-off-by: Jigar Agrawal <[email protected]>
Jigar Agrawal 3 жил өмнө
parent
commit
41d8370e72

+ 4 - 1
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -2638,8 +2638,11 @@ static int __cam_req_mgr_try_cancel_req(struct cam_req_mgr_core_link *link,
 	case CRM_SLOT_STATUS_REQ_PENDING:
 	case CRM_SLOT_STATUS_REQ_APPLIED:
 		pd = __cam_req_mgr_get_dev_pd(link, CAM_REQ_MGR_DEVICE_IFE);
-		if (pd < 0)
+		if ((pd < 0) || (pd >= CAM_PIPELINE_DELAY_MAX)) {
+			CAM_ERR(CAM_CRM, "pd: %d link_hdl: 0x%x red_id: %d", pd,
+				link->link_hdl, flush_info->req_id);
 			return pd;
+		}
 
 		if (flush_info->req_id <= link->req.prev_apply_data[pd].req_id) {
 			CAM_WARN(CAM_CRM, "req %lld already applied to IFE on link 0x%x",