Subject: CVE-2023-52888: media: mediatek: vcodec: Only free buffer VA that is not NULL

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

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

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

media: mediatek: vcodec: Only free buffer VA that is not NULL

In the MediaTek vcodec driver, while mtk_vcodec_mem_free() is mostly
called only when the buffer to free exists, there are some instances
that didn't do the check and triggered warnings in practice.

We believe those checks were forgotten unintentionally. Add the checks
back to fix the warnings.

The Linux kernel CVE team has assigned CVE-2023-52888 to this issue.

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

	Fixed in 6.6.39 with commit 5c217253c76c
	Fixed in 6.9.9 with commit 303d01082eda
	Fixed in 6.10 with commit eb005c801ec7

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-2023-52888
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/decoder/vdec/vdec_av1_req_lat_if.c
	drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_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/5c217253c76c94f76d1df31d0bbdcb88dc07be91
	https://git.kernel.org/stable/c/303d01082edaf817ee2df53a40dca9da637a2c04
	https://git.kernel.org/stable/c/eb005c801ec70ff4307727bd3bd6e8280169ef32