Subject: CVE-2024-35919: media: mediatek: vcodec: adding lock to protect encoder context list

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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

Add a lock for the ctx_list, to avoid accessing a NULL pointer
within the 'vpu_enc_ipi_handler' function when the ctx_list has
been deleted due to an unexpected behavior on the SCP IP block.

The Linux kernel CVE team has assigned CVE-2024-35919 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.6 with commit 1972e32431ed and fixed in 6.6.27 with commit 41671f0c0182
	Issue introduced in 6.6 with commit 1972e32431ed and fixed in 6.8.6 with commit 51c84a8aac6e
	Issue introduced in 6.6 with commit 1972e32431ed and fixed in 6.9 with commit afaaf3a0f647

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-35919
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c
	drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
	drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
	drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/41671f0c0182b2bae74ca7e3b0f155559e3e2fc5
	https://git.kernel.org/stable/c/51c84a8aac6e3b59af2b0e92ba63cabe2e641a2d
	https://git.kernel.org/stable/c/afaaf3a0f647a24a7bf6a2145d8ade37baaf75ad