瀏覽代碼

Merge "msm: camera: isp: Add checks to ensure valid out resource info in dump" into camera-kernel.lnx.4.0

Haritha Chintalapati 4 年之前
父節點
當前提交
31615a50c2

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

@@ -7599,19 +7599,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:
 		return CAM_VFE_BUS_VER3_VFE_OUT_GAMMA;
 	default:
+		CAM_WARN(CAM_ISP, "Invalid isp res id: %d , assigning max",
+			res_type);
 		return CAM_VFE_BUS_VER3_VFE_OUT_MAX;
 	}
 }
@@ -2508,8 +2510,26 @@ static int cam_vfe_bus_ver3_print_dimensions(
 	int                                        i;
 	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_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++) {
 		wm_data = rsrc_data->wm_res[i].res_priv;
 		common_data = rsrc_data->common_data;