media: mediatek: vcodec: Handle invalid encoder vsi
authorIrui Wang <irui.wang@mediatek.com>
Sat, 7 Oct 2023 11:33:47 +0000 (19:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:33 +0000 (11:59 +0100)
commita4b31459ce9a85d057ced23f1d67ba8c3def8f88
treeec99b1ea8a7465807af717c2fcba64201a5e11df
parent0747b6f7a3595d45bf81482024da192e6c81455b
media: mediatek: vcodec: Handle invalid encoder vsi

[ Upstream commit 19e2e01f30b5d2b448b5db097130486ea95af36f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c