[<prev] [next>] [day] [month] [year] [list]
Message-Id: <f7a5cd01795a0ec1e45cbbf80292288bf1ddada1.1667289227.git.ming.qian@nxp.com>
Date: Tue, 1 Nov 2022 16:04:20 +0800
From: Ming Qian <ming.qian@....com>
To: mchehab@...nel.org, hverkuil-cisco@...all.nl
Cc: shawnguo@...nel.org, robh+dt@...nel.org, s.hauer@...gutronix.de,
kernel@...gutronix.de, festevam@...il.com, linux-imx@....com,
xiahong.bao@....com, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH] media: amphion: add lock around vdec_g_fmt
the capture format may be changed when
sequence header is parsed,
it may be read and write in the same time,
add lock around vdec_g_fmt to synchronize it
Fixes: 6de8d628df6e ("media: amphion: add v4l2 m2m vpu decoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@....com>
---
drivers/media/platform/amphion/vdec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c
index 0d7676eee5ea..87f9f8e90ab1 100644
--- a/drivers/media/platform/amphion/vdec.c
+++ b/drivers/media/platform/amphion/vdec.c
@@ -314,6 +314,7 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f)
struct vpu_format *cur_fmt;
int i;
+ vpu_inst_lock(inst);
cur_fmt = vpu_get_format(inst, f->type);
pixmp->pixelformat = cur_fmt->pixfmt;
@@ -331,6 +332,7 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f)
f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
+ vpu_inst_unlock(inst);
return 0;
}
--
2.38.1
Powered by blists - more mailing lists