[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231007113347.28863-1-irui.wang@mediatek.com>
Date: Sat, 7 Oct 2023 19:33:47 +0800
From: Irui Wang <irui.wang@...iatek.com>
To: Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
<angelogioacchino.delregno@...labora.com>,
<nicolas.dufresne@...labora.com>,
Yunfei Dong <yunfei.dong@...iatek.com>,
Irui Wang <irui.wang@...iatek.com>
CC: <Project_Global_Chrome_Upstream_Group@...iatek.com>,
<linux-media@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
Maoguang Meng <maoguang.meng@...iatek.com>
Subject: [PATCH v2] media: mediatek: vcodec: Handle invalid encoder vsi
Handle invalid encoder vsi in vpu_enc_init to ensure the encoder
vsi is valid for future use.
Fixes: 1972e32431ed ("media: mediatek: vcodec: Fix possible invalid memory access for encoder")
Signed-off-by: Irui Wang <irui.wang@...iatek.com>
---
changed with v1:
- add Fixes tag
- move vsi check to vpu_enc_init
- update commit message
---
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c
index d299cc2962a5..39e8f3ac53ca 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c
@@ -153,6 +153,11 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)
return -EINVAL;
}
+ if (IS_ERR_OR_NULL(vpu->vsi)) {
+ mtk_venc_err(vpu->ctx, "invalid venc vsi");
+ return -EINVAL;
+ }
+
return 0;
}
--
2.18.0
Powered by blists - more mailing lists