7.8high
drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()'
- Severity
- 7.8high CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.22% (higher than 12% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()' The `kfd_get_cu_occupancy` function previously declared a large `cu_occupancy` array as a local variable, which could lead to stack overflows due to excessive stack usage. This commit replaces the static array allocation with dynamic memory allocation using `kcalloc`, thereby reducing the stack size. This change avoids the risk of stack overflows in kernel space, in scenarios where `AMDGPU_MAX_QUEUES` is large. The allocated memory is freed using `kfree` before the function returns to prevent memory leaks. Fixes the below with gcc W=1: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c: In function ‘kfd_get_cu_occupancy’: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:322:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=] 322 | } | ^
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 6ae9e1aba97e4cdaa31a0bfdc07497ad0e915c84 before 6d9f07196389f35a3afebcf1a12c1425725caddd, from 6ae9e1aba97e4cdaa31a0bfdc07497ad0e915c84 before 922f0e00017b09d9d47e3efac008c8b20ed546a0, 6.12 Not affected: before 6.12, from 6.12.2 up to 6.12.*, from 6.13 up to * | CVE List |
| linux linux_kernel | from 6.12 before 6.12.2 | NVD |
All scores
| CISA-ADP | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()' The `kfd_get_cu_occupancy` function previously declared a large `cu_occupancy` array as a local variable, which could lead to stack overflows due to excessive stack usage. This commit replaces the static array allocation with dynamic memory allocation using `kcalloc`, thereby reducing the stack size. This change avoids the risk of stack overflows in kernel space, in scenarios where `AMDGPU_MAX_QUEUES` is large. The allocated memory is freed using `kfree` before the function returns to prevent memory leaks. Fixes the below with gcc W=1: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c: In function ‘kfd_get_cu_occupancy’: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:322:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=] 322 | } | ^
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: drm/amdkfd: Uso de asignación dinámica para la matriz de ocupación de CU en 'kfd_get_cu_occupancy()' La función `kfd_get_cu_occupancy` declaró anteriormente una matriz `cu_occupancy` grande como una variable local, lo que podría provocar desbordamientos de pila debido al uso excesivo de la pila. Esta confirmación reemplaza la asignación de matriz estática con asignación de memoria dinámica utilizando `kcalloc`, lo que reduce el tamaño de la pila. Este cambio evita el riesgo de desbordamientos de pila en el espacio del kernel, en escenarios donde `AMDGPU_MAX_QUEUES` es grande. La memoria asignada se libera utilizando `kfree` antes de que la función regrese para evitar fugas de memoria. Corrige lo siguiente con gcc W=1: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c: En la función 'kfd_get_cu_occupancy': drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:322:1: advertencia: el tamaño del marco de 1056 bytes es mayor que 1024 bytes [-Wframe-larger-than=] 322 | } | ^
References
| https://git.kernel.org/stable/c/6d9f07196389f35a3afebcf1a12c1425725caddd | mailing-list, patch | |
| https://git.kernel.org/stable/c/922f0e00017b09d9d47e3efac008c8b20ed546a0 | mailing-list, patch | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-56695 changed 2026-05-11 | CVE Terms of Use |
| NVD | CVE-2024-56695 changed 2026-06-17 | Public domain |