Subject: CVE-2024-46818: drm/amd/display: Check gpio_id before used as array index

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

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

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

drm/amd/display: Check gpio_id before used as array index

[WHY & HOW]
GPIO_ID_UNKNOWN (-1) is not a valid value for array index and therefore
should be checked in advance.

This fixes 5 OVERRUN issues reported by Coverity.

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

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

	Fixed in 5.4.284 with commit 8520fdc8ecc3
	Fixed in 5.10.226 with commit 40c2e8bc117c
	Fixed in 5.15.167 with commit 0184cca30cad
	Fixed in 6.1.109 with commit 276e3fd93e3b
	Fixed in 6.6.50 with commit 08e7755f754e
	Fixed in 6.10.9 with commit 3d4198ab612a
	Fixed in 6.11 with commit 2a5626eeb3b5

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-46818
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/gpu/drm/amd/display/dc/gpio/gpio_service.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/8520fdc8ecc38f240a8e9e7af89cca6739c3e790
	https://git.kernel.org/stable/c/40c2e8bc117cab8bca8814735f28a8b121654a84
	https://git.kernel.org/stable/c/0184cca30cad74d88f5c875d4e26999e26325700
	https://git.kernel.org/stable/c/276e3fd93e3beb5894eb1cc8480f9f417d51524d
	https://git.kernel.org/stable/c/08e7755f754e3d2cef7d3a7da538d33526bd6f7c
	https://git.kernel.org/stable/c/3d4198ab612ad48f73383ad3bb5663e6f0cdf406
	https://git.kernel.org/stable/c/2a5626eeb3b5eec7a36886f9556113dd93ec8ed6