Subject: CVE-2024-26912: drm/nouveau: fix several DMA buffer leaks

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

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

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

drm/nouveau: fix several DMA buffer leaks

Nouveau manages GSP-RM DMA buffers with nvkm_gsp_mem objects.  Several of
these buffers are never dealloced.  Some of them can be deallocated
right after GSP-RM is initialized, but the rest need to stay until the
driver unloads.

Also futher bullet-proof these objects by poisoning the buffer and
clearing the nvkm_gsp_mem object when it is deallocated.  Poisoning
the buffer should trigger an error (or crash) from GSP-RM if it tries
to access the buffer after we've deallocated it, because we were wrong
about when it is safe to deallocate.

Finally, change the mem->size field to a size_t because that's the same
type that dma_alloc_coherent expects.

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

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

	Issue introduced in 6.7 with commit 176fdcbddfd2 and fixed in 6.7.6 with commit 6190d4c08897
	Issue introduced in 6.7 with commit 176fdcbddfd2 and fixed in 6.8 with commit 042b5f83841f

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-26912
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/nouveau/include/nvkm/subdev/gsp.h
	drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.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/6190d4c08897d748dd25f0b78267a90aa1694e15
	https://git.kernel.org/stable/c/042b5f83841fbf7ce39474412db3b5e4765a7ea7