diff options
author | Irui Wang <irui.wang@mediatek.com> | 2023-10-07 19:33:47 +0800 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-10-13 11:33:22 +0200 |
commit | 19e2e01f30b5d2b448b5db097130486ea95af36f (patch) | |
tree | 31e3f6a3fb2592b5268892700e836652cf8b5c47 /drivers/media | |
parent | 32ec99f872aba071a070f61fcab2f3a068b50652 (diff) |
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@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; } |