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

Commit 6e4dabbc authored by annamraj's avatar annamraj Committed by Gerrit - the friendly Code Review server
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: I955b30a7d05554366df3a2e6c44fc21c5367b2c2
Signed-off-by: default avatarannamraj <annamraj@codeaurora.org>
parent b67a90fb
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -756,9 +756,12 @@ 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;
}

/*
@@ -835,11 +838,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;
}