diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c index 4b2c656ca2..e6f731b384 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c @@ -1821,6 +1821,14 @@ int cam_ife_csid_ver1_release(void *hw_priv, csid_hw->hw_intf->hw_idx, res->res_type, res->res_id); path_cfg = (struct cam_ife_csid_ver1_path_cfg *)res->res_priv; + + if (path_cfg->cid >= CAM_IFE_CSID_CID_MAX) { + CAM_ERR(CAM_ISP, "CSID:%d Invalid cid:%d", + csid_hw->hw_intf->hw_idx, path_cfg->cid); + rc = -EINVAL; + goto end; + } + cam_ife_csid_cid_release(&csid_hw->cid_data[path_cfg->cid], csid_hw->hw_intf->hw_idx, path_cfg->cid); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c index 6c8f9db082..0b8e19e0bc 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c @@ -3506,6 +3506,13 @@ int cam_ife_csid_ver2_release(void *hw_priv, path_cfg = (struct cam_ife_csid_ver2_path_cfg *)res->res_priv; + if (path_cfg->cid >= CAM_IFE_CSID_CID_MAX) { + CAM_ERR(CAM_ISP, "CSID:%d Invalid cid:%d", + csid_hw->hw_intf->hw_idx, path_cfg->cid); + rc = -EINVAL; + goto end; + } + cam_ife_csid_cid_release(&csid_hw->cid_data[path_cfg->cid], csid_hw->hw_intf->hw_idx, path_cfg->cid);