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

Added missing lock to avoid race conditon for dqbuf and
streamon.

Change-Id: I260dfc964066ad68552dfab0c43584708cfc8b8e
Signed-off-by: E V Ravi <evenka@codeaurora.org>
This commit is contained in:
E V Ravi 2019-07-05 15:45:49 +05:30 committed by Gerrit - the friendly Code Review server
parent a18db927c6
commit a54cd970d8

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -795,8 +795,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;
}
/*
@ -811,10 +815,12 @@ 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))
return -EINVAL;
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)