summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-07-10 12:56:02 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-07-10 12:56:02 -0700
commit6355b448f58608fdcc30c0421f417a27600b6933 (patch)
treef019f3d2edfcfa0a4ec61b4c58eceb68094cd814
parent4cd8dfc38f7eb1fa13ac7b5d6db1609a263f65f3 (diff)
parenta54cd970d87e77a78262efb21e0ce4f72e1d4e26 (diff)
Merge "msm: ais: jpegdma: Added missing lock for dqbuf and streamon"
-rw-r--r--drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_dev.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_dev.c b/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_dev.c
index 61200d379a1d..273cec87bb8e 100644
--- a/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_dev.c
+++ b/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_dev.c
@@ -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))
+ mutex_lock(&ctx->lock);
+ if (!msm_jpegdma_config_ok(ctx)) {
+ mutex_unlock(&ctx->lock);
return -EINVAL;
+ }
- mutex_lock(&ctx->lock);
ret = v4l2_m2m_streamon(file, ctx->m2m_ctx, buf_type);
if (ret < 0)