فهرست منبع

msm: camera: jpeg: Add null check for ctx_data in IRQ handler

Check if ctx_data is null after assignment but before checking if it's in use.

CRs-Fixed: 3026736
Change-Id: I366383cbd30b7c22c16610d7b73e4e0ad8f74a55
Signed-off-by: Karthik Jayakumar <[email protected]>
Karthik Jayakumar 3 سال پیش
والد
کامیت
f31aaa8d2d

+ 6 - 0
drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c

@@ -357,6 +357,12 @@ static int cam_jpeg_mgr_bottom_half_irq(void *priv, void *data)
 	irq_cb_data = (struct cam_jpeg_irq_cb_data *)task_data->data;
 
 	ctx_data = (struct cam_jpeg_hw_ctx_data *)irq_cb_data->private_data;
+
+	if (!ctx_data) {
+		CAM_ERR(CAM_JPEG, "No ctx data found!");
+		return -EINVAL;
+	}
+
 	if (!ctx_data->in_use) {
 		CAM_ERR(CAM_JPEG, "ctx is not in use");
 		return -EINVAL;

+ 2 - 0
drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c

@@ -429,6 +429,7 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type,
 		}
 
 		irq_cb_data = &irq_cb->irq_cb_data;
+		spin_lock(&jpeg_dma_dev->hw_lock);
 		if (irq_cb->b_set_cb) {
 			core_info->irq_cb.jpeg_hw_mgr_cb =
 				irq_cb->jpeg_hw_mgr_cb;
@@ -439,6 +440,7 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type,
 			core_info->irq_cb.irq_cb_data.jpeg_req = NULL;
 			core_info->irq_cb.irq_cb_data.private_data = NULL;
 		}
+		spin_unlock(&jpeg_dma_dev->hw_lock);
 		rc = 0;
 		break;
 	}

+ 2 - 0
drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.c

@@ -556,6 +556,7 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type,
 		}
 
 		irq_cb_data = &irq_cb->irq_cb_data;
+		spin_lock(&jpeg_enc_dev->hw_lock);
 
 		if (irq_cb->b_set_cb) {
 			core_info->irq_cb.jpeg_hw_mgr_cb = irq_cb->jpeg_hw_mgr_cb;
@@ -566,6 +567,7 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type,
 			core_info->irq_cb.irq_cb_data.private_data = NULL;
 			core_info->irq_cb.irq_cb_data.jpeg_req = NULL;
 		}
+		spin_unlock(&jpeg_enc_dev->hw_lock);
 		rc = 0;
 		break;
 	}