Subject: CVE-2024-49991: drm/amdkfd: amdkfd_free_gtt_mem clear the correct pointer

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

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

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

drm/amdkfd: amdkfd_free_gtt_mem clear the correct pointer

Pass pointer reference to amdgpu_bo_unref to clear the correct pointer,
otherwise amdgpu_bo_unref clear the local variable, the original pointer
not set to NULL, this could cause use-after-free bug.

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

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

	Fixed in 6.6.55 with commit 30ceb873cc2e
	Fixed in 6.10.14 with commit 71f3240f8298
	Fixed in 6.11.3 with commit 6c9289806591
	Fixed in 6.12-rc1 with commit c86ad39140bb

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-49991
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/amdgpu/amdgpu_amdkfd.c
	drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
	drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
	drivers/gpu/drm/amd/amdkfd/kfd_device.c
	drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
	drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
	drivers/gpu/drm/amd/amdkfd/kfd_process.c
	drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.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/30ceb873cc2e97348d9da2265b2d1ddf07f682e1
	https://git.kernel.org/stable/c/71f3240f82987f0f070ea5bed559033de7d4c0e1
	https://git.kernel.org/stable/c/6c9289806591807e4e3be9a23df8ee2069180055
	https://git.kernel.org/stable/c/c86ad39140bbcb9dc75a10046c2221f657e8083b