Procházet zdrojové kódy

Merge "msm: camera: cre: Fix out-of-bounds access in cre driver" into camera-kernel.lnx.7.0

Camera Software Integration před 1 rokem
rodič
revize
5d3025540c

+ 4 - 0
drivers/cam_cre/cam_cre_hw_mgr/cre_hw/bus_rd/cre_bus_rd.c

@@ -139,6 +139,10 @@ static int cam_cre_bus_rd_update(struct cam_cre_hw *cam_cre_hw_info,
 
 	in_port_idx =
 	cam_cre_bus_rd_in_port_idx(io_buf->resource_type);
+	if (in_port_idx < 0) {
+		CAM_ERR(CAM_CRE, "Invalid in_port_idx for resource %d", io_buf->resource_type);
+		return -EINVAL;
+	}
 
 	CAM_DBG(CAM_CRE, "in_port_idx %d", in_port_idx);
 	for (k = 0; k < io_buf->num_planes; k++) {