Subject: CVE-2023-52691: drm/amd/pm: fix a double-free in si_dpm_init

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

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

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

drm/amd/pm: fix a double-free in si_dpm_init

When the allocation of
adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries fails,
amdgpu_free_extended_power_table is called to free some fields of adev.
However, when the control flow returns to si_dpm_sw_init, it goes to
label dpm_failed and calls si_dpm_fini, which calls
amdgpu_free_extended_power_table again and free those fields again. Thus
a double-free is triggered.

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

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

	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 4.19.306 with commit afe9f5b871f8
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 5.4.268 with commit 06d95c99d5a4
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 5.10.209 with commit aeed2b4e4a70
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 5.15.148 with commit 2bf47c89bbac
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 6.1.75 with commit f957a1be647f
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 6.6.14 with commit fb1936cb5872
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 6.7.2 with commit ca8e2e251c65
	Issue introduced in 4.9 with commit 841686df9f7d and fixed in 6.8 with commit ac16667237a8

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-52691
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/pm/legacy-dpm/si_dpm.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/afe9f5b871f86d58ecdc45b217b662227d7890d0
	https://git.kernel.org/stable/c/06d95c99d5a4f5accdb79464076efe62e668c706
	https://git.kernel.org/stable/c/aeed2b4e4a70c7568d4a5eecd6a109713c0dfbf4
	https://git.kernel.org/stable/c/2bf47c89bbaca2bae16581ef1b28aaec0ade0334
	https://git.kernel.org/stable/c/f957a1be647f7fc65926cbf572992ec2747a93f2
	https://git.kernel.org/stable/c/fb1936cb587262cd539e84b34541abb06e42b2f9
	https://git.kernel.org/stable/c/ca8e2e251c65e5a712f6025e27bd9b26d16e6f4a
	https://git.kernel.org/stable/c/ac16667237a82e2597e329eb9bc520d1cf9dff30