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

Commit 0712459d authored by annamraj's avatar annamraj
Browse files

msm: jpegdma: Fix for ASAN issues in jpegdma module



Adding Lock mechanism to avoid concurrency issues between reqbufs
and streamoff calls.

Change-Id: Id0789db02598bed0a66814168bf65c486f249ca4
Signed-off-by: default avatarannamraj <annamraj@codeaurora.org>
parent ccf21f85
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -816,9 +816,13 @@ static int msm_jpegdma_s_fmt_vid_out(struct file *file,
static int msm_jpegdma_reqbufs(struct file *file,
	void *fh, struct v4l2_requestbuffers *req)
{
	int ret = 0;
	struct jpegdma_ctx *ctx = msm_jpegdma_ctx_from_fh(fh);

	return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, req);
	mutex_lock(&ctx->lock);
	ret = v4l2_m2m_reqbufs(file, ctx->m2m_ctx, req);
	mutex_unlock(&ctx->lock);
	return ret;
}

/*
@@ -925,11 +929,11 @@ static int msm_jpegdma_streamoff(struct file *file,
{
	struct jpegdma_ctx *ctx = msm_jpegdma_ctx_from_fh(fh);
	int ret;

	mutex_lock(&ctx->lock);
	ret = v4l2_m2m_streamoff(file, ctx->m2m_ctx, buf_type);
	if (ret < 0)
		dev_err(ctx->jdma_device->dev, "Stream off fails\n");

	mutex_unlock(&ctx->lock);
	return ret;
}