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

Commit a8929113 authored by VijayaKumar T M's avatar VijayaKumar T M Committed by Vandana Jain
Browse files

msm: camera: jpegdma: Added missing lock for dqbuf and streamon



Added missing lock to avoid race conditon for dqbuf and
streamon

CRs-Fixed: 2376566
Change-Id: I1c0ef9014914a9892c4d443600618c52d0aeebfa
Signed-off-by: default avatarVijayaKumar T M <vtmuni@codeaurora.org>
Signed-off-by: default avatarVandana Jain <vandja@codeaurora.org>
parent 93df5326
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -892,8 +892,12 @@ static int msm_jpegdma_dqbuf(struct file *file,
	void *fh, struct v4l2_buffer *buf)
{
	struct jpegdma_ctx *ctx = msm_jpegdma_ctx_from_fh(fh);
	int ret;

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

/*
@@ -908,13 +912,15 @@ static int msm_jpegdma_streamon(struct file *file,
	struct jpegdma_ctx *ctx = msm_jpegdma_ctx_from_fh(fh);
	int ret;

	if (!msm_jpegdma_config_ok(ctx))
	mutex_lock(&ctx->lock);
	if (!msm_jpegdma_config_ok(ctx)) {
		mutex_unlock(&ctx->lock);
		return -EINVAL;

	}
	ret = v4l2_m2m_streamon(file, ctx->m2m_ctx, buf_type);
	if (ret < 0)
		dev_err(ctx->jdma_device->dev, "Stream on fail\n");

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