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

msm: camera: isp: Add checks to ensure valid out resource info in dump

Currently, in case of violation on camif side, we initiate hw dump
with event info havinf input resource id. This resource id is not
applicable on vfe bus side. Add necessary check to ensure only valid
vfe out resource info is dumped.

CRs-Fixed: 2814398
Change-Id: Ifc7bac81e7a4d9993e1492b609b84d64ea3fd1f4
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Mukund Madhusudan Atre 4 жил өмнө
parent
commit
eafe327153

+ 15 - 13
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -7598,19 +7598,21 @@ static int cam_ife_hw_mgr_handle_hw_dump_info(
 		}
 		}
 	}
 	}
 
 
-	out_port_id = event_info->res_id & 0xFF;
-	hw_mgr_res =
-		&ife_hw_mgr_ctx->res_list_ife_out[out_port_id];
-	for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
-		if (!hw_mgr_res->hw_res[i])
-			continue;
-		hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
-		if (hw_intf->hw_ops.process_cmd) {
-			rc = hw_intf->hw_ops.process_cmd(
-				hw_intf->hw_priv,
-				CAM_ISP_HW_CMD_DUMP_BUS_INFO,
-				(void *)event_info,
-				sizeof(struct cam_isp_hw_event_info));
+	if (event_info->res_type == CAM_ISP_RESOURCE_VFE_OUT) {
+		out_port_id = event_info->res_id & 0xFF;
+		hw_mgr_res =
+			&ife_hw_mgr_ctx->res_list_ife_out[out_port_id];
+		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
+			if (!hw_mgr_res->hw_res[i])
+				continue;
+			hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
+			if (hw_intf->hw_ops.process_cmd) {
+				rc = hw_intf->hw_ops.process_cmd(
+					hw_intf->hw_priv,
+					CAM_ISP_HW_CMD_DUMP_BUS_INFO,
+					(void *)event_info,
+					sizeof(struct cam_isp_hw_event_info));
+			}
 		}
 		}
 	}
 	}
 
 

+ 20 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -630,6 +630,8 @@ static enum cam_vfe_bus_ver3_vfe_out_type
 	case CAM_ISP_IFE_LITE_OUT_RES_GAMMA:
 	case CAM_ISP_IFE_LITE_OUT_RES_GAMMA:
 		return CAM_VFE_BUS_VER3_VFE_OUT_GAMMA;
 		return CAM_VFE_BUS_VER3_VFE_OUT_GAMMA;
 	default:
 	default:
+		CAM_WARN(CAM_ISP, "Invalid isp res id: %d , assigning max",
+			res_type);
 		return CAM_VFE_BUS_VER3_VFE_OUT_MAX;
 		return CAM_VFE_BUS_VER3_VFE_OUT_MAX;
 	}
 	}
 }
 }
@@ -2508,8 +2510,26 @@ static int cam_vfe_bus_ver3_print_dimensions(
 	int                                        i;
 	int                                        i;
 	uint32_t addr_status0, addr_status1, addr_status2, addr_status3;
 	uint32_t addr_status0, addr_status1, addr_status2, addr_status3;
 
 
+	if (!bus_priv) {
+		CAM_ERR(CAM_ISP, "Invalid bus private data, res_id: %d",
+			vfe_out_res_id);
+		return -EINVAL;
+	}
+
+	if (vfe_out_res_id >= CAM_VFE_BUS_VER3_VFE_OUT_MAX) {
+		CAM_ERR(CAM_ISP, "Invalid out resource for dump: %d",
+			vfe_out_res_id);
+		return -EINVAL;
+	}
+
 	rsrc_node = &bus_priv->vfe_out[vfe_out_res_id];
 	rsrc_node = &bus_priv->vfe_out[vfe_out_res_id];
 	rsrc_data = rsrc_node->res_priv;
 	rsrc_data = rsrc_node->res_priv;
+	if (!rsrc_data) {
+		CAM_ERR(CAM_ISP, "VFE out data is null, res_id: %d",
+			vfe_out_res_id);
+		return -EINVAL;
+	}
+
 	for (i = 0; i < rsrc_data->num_wm; i++) {
 	for (i = 0; i < rsrc_data->num_wm; i++) {
 		wm_data = rsrc_data->wm_res[i].res_priv;
 		wm_data = rsrc_data->wm_res[i].res_priv;
 		common_data = rsrc_data->common_data;
 		common_data = rsrc_data->common_data;