media: mediatek: vcodec: Fix possible invalid memory access for encoder
authorYunfei Dong <yunfei.dong@mediatek.com>
Wed, 2 Aug 2023 14:53:02 +0000 (22:53 +0800)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:58:34 +0000 (07:58 +0200)
commit1972e32431ed14682909ad568c6fd660572ae6ab
treef3fe7e827cac26cd7215906f885aca28c0c553db
parent655b86e52eacdce79c2e02c5ec7258a97fcc2e4a
media: mediatek: vcodec: Fix possible invalid memory access for encoder

The vpu maybe null pointer or unreasonable value when scp crash, need to
validate that the vpu pointer and the vpu instance within this context is
valid in case of leading to kernel reboot.

Fixes: 27a274db6b4c ("[media] vcodec: mediatek: Add Mediatek VP8 Video Encoder Driver")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reported-by: Steve Cho <stevecho@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c