Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19d0e22e authored by Sunid Wilson's avatar Sunid Wilson Committed by Matt Wagantall
Browse files

msm: jpeg: dma: Check for buffer list empty



Add src and dest buffer pointer validation.

Change-Id: I2f8700114c0bbb3857c20176191524a75c70ac15
Signed-off-by: default avatarSunid Wilson <sunidw@codeaurora.org>
parent 8c9f516b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1067,6 +1067,10 @@ static void msm_jpegdma_device_run(void *priv)

	dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
	src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
	if (src_buf == NULL || dst_buf == NULL) {
		dev_err(ctx->jdma_device->dev, "Error, buffer list empty\n");
		return;
	}

	if (ctx->pending_config) {
		msm_jpegdma_schedule_next_config(ctx);
@@ -1127,6 +1131,12 @@ void msm_jpegdma_isr_processing_done(struct msm_jpegdma_device *dma)
		if (ctx->plane_idx >= formats[ctx->format_idx].num_planes) {
			src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
			dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
			if (src_buf == NULL || dst_buf == NULL) {
				dev_err(ctx->jdma_device->dev, "Error, buffer list empty\n");
				mutex_unlock(&ctx->lock);
				mutex_unlock(&dma->lock);
				return;
			}
			complete_all(&ctx->completion);
			ctx->plane_idx = 0;

@@ -1137,6 +1147,12 @@ void msm_jpegdma_isr_processing_done(struct msm_jpegdma_device *dma)
		} else {
			dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
			src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
			if (src_buf == NULL || dst_buf == NULL) {
				dev_err(ctx->jdma_device->dev, "Error, buffer list empty\n");
				mutex_unlock(&ctx->lock);
				mutex_unlock(&dma->lock);
				return;
			}
			msm_jpegdma_process_buffers(ctx, src_buf, dst_buf);
		}
		mutex_unlock(&ctx->lock);