CVE-2024-56695

drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()'

High · published December 28, 2024

CVSS v3.1
7.8
EPSS
0%
Percentile
11.3
In the wild
Unconfirmed
What it is

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 | }

| ^

The record
Technical detail
CVSS v3.1
7.8 · HIGH
Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.00215 · 11.3th percentile
Published
2024-12-28T09:46Z
EPSS history
Timeline
  • 28 DEC 09:46Z
    drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()'
    cvelistv5