Skip to content

Commit 19e2e01

Browse files
irui-wangHans Verkuil
authored andcommitted
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: 1972e32 ("media: mediatek: vcodec: Fix possible invalid memory access for encoder") Signed-off-by: Irui Wang <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 32ec99f commit 19e2e01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)
153153
return -EINVAL;
154154
}
155155

156+
if (IS_ERR_OR_NULL(vpu->vsi)) {
157+
mtk_venc_err(vpu->ctx, "invalid venc vsi");
158+
return -EINVAL;
159+
}
160+
156161
return 0;
157162
}
158163

0 commit comments

Comments
 (0)