FROMLIST: media: mediatek: vcodec: adding lock to protect encoder context list

The ctx_list will be deleted when scp getting unexpected behavior, then the
ctx_list->next will be NULL, the kernel driver maybe access NULL pointer in
function vpu_enc_ipi_handler when going through each context, then reboot.

Need to add lock to protect the ctx_list to make sure the ctx_list->next isn't
NULL pointer.

Fixes: 1972e32431ed ("media: mediatek: vcodec: Fix possible invalid memory access for encoder")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
(am from https://patchwork.linuxtv.org/patch/99300/)
(also found at https://lore.kernel.org/r/20240222092609.31382-3-yunfei.dong@mediatek.com)

BUG=b:317459192
TEST=emerge-jacuzzi chromeos-kernel-5-10
UPSTREAM-TASK=b:326854739

Change-Id: I98bfac7386fd101a6d97b862a00dc20c6347ecb4
Signed-off-by: Pin-yen Lin <treapking@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5321187
Reviewed-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Sean Paul <sean@poorly.run>
(cherry picked from commit 1f399dabcba2eb11607359aecb3984e9366c76d9)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5323586
4 files changed