# CVE-2024-39291: drm/amdgpu: Fix buffer size in gfx\_v9\_4\_3\_init\_ cp\_compute\_microcode() and rlc\_microcode()

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.35% (percentile 21, 2026-11-26)
- **CWE:** CWE-120
- **Published:** 2024-06-24T13:52:26.082Z
- **Modified:** 2026-06-17T07:41:39.350Z

## Who should check

- Anyone running Linux \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< 19bd9537b6bc1c882df25206c15917214d8e9460; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< f1b6a016dfa45cedc080d36fa5d6f22237d80e8b; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< acce6479e30f73ab0872e93a75aed1fb791d04ec
- Anyone running Linux 6.5

## Description

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

drm/amdgpu: Fix buffer size in gfx\_v9\_4\_3\_init\_ cp\_compute\_microcode() and rlc\_microcode()

The function gfx\_v9\_4\_3\_init\_microcode in gfx\_v9\_4\_3.c was generating
about potential truncation of output when using the snprintf function.
The issue was due to the size of the buffer 'ucode\_prefix' being too
small to accommodate the maximum possible length of the string being
written into it.

The string being written is "amdgpu/%s\_mec.bin" or "amdgpu/%s\_rlc.bin",
where %s is replaced by the value of 'chip\_name'. The length of this
string without the %s is 16 characters. The warning message indicated
that 'chip\_name' could be up to 29 characters long, resulting in a total
of 45 characters, which exceeds the buffer size of 30 characters.

To resolve this issue, the size of the 'ucode\_prefix' buffer has been
reduced from 30 to 15. This ensures that the maximum possible length of
the string being written into the buffer will not exceed its size, thus
preventing potential buffer overflow and truncation issues.

Fixes the below with gcc W=1:
drivers/gpu/drm/amd/amdgpu/gfx\_v9\_4\_3.c: In function ‘gfx\_v9\_4\_3\_early\_init’:
drivers/gpu/drm/amd/amdgpu/gfx\_v9\_4\_3.c:379:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 \[-Wformat-truncation=\]
  379 \|         snprintf(fw\_name, sizeof(fw\_name), "amdgpu/%s\_rlc.bin", chip\_name);
      \|                                                    ^~
......
  439 \|         r = gfx\_v9\_4\_3\_init\_rlc\_microcode(adev, ucode\_prefix);
      \|                                                 ~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx\_v9\_4\_3.c:379:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
  379 \|         snprintf(fw\_name, sizeof(fw\_name), "amdgpu/%s\_rlc.bin", chip\_name);
      \|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx\_v9\_4\_3.c:413:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 \[-Wformat-truncation=\]
  413 \|         snprintf(fw\_name, sizeof(fw\_name), "amdgpu/%s\_mec.bin", chip\_name);
      \|                                                    ^~
......
  443 \|         r = gfx\_v9\_4\_3\_init\_cp\_compute\_microcode(adev, ucode\_prefix);
      \|                                                        ~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx\_v9\_4\_3.c:413:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
  413 \|         snprintf(fw\_name, sizeof(fw\_name), "amdgpu/%s\_mec.bin", chip\_name);
      \|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

## Affected and fixed versions

- Linux: \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< 19bd9537b6bc1c882df25206c15917214d8e9460; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< f1b6a016dfa45cedc080d36fa5d6f22237d80e8b; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< acce6479e30f73ab0872e93a75aed1fb791d04ec (cvelist)
- Linux: 6.5 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-39291. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-39291.md
Affected: Linux >= 86301129698be52f8398f92ea8564168f6bfcae1, < 19bd9537b6bc1c882df25206c15917214d8e9460; >= 86301129698be52f8398f92ea8564168f6bfcae1, < f1b6a016dfa45cedc080d36fa5d6f22237d80e8b; >= 86301129698be52f8398f92ea8564168f6bfcae1, < acce6479e30f73ab0872e93a75aed1fb791d04ec; Linux 6.5
Fixed in: Linux 19bd9537b6bc1c882df25206c15917214d8e9460

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-39291 being exploited?

There is no confirmed exploitation: CVE-2024-39291 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.35% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-39291?

High: CVSS 7.8 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-39291?

Linux \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< 19bd9537b6bc1c882df25206c15917214d8e9460; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< f1b6a016dfa45cedc080d36fa5d6f22237d80e8b; \>= 86301129698be52f8398f92ea8564168f6bfcae1, \< acce6479e30f73ab0872e93a75aed1fb791d04ec; Linux 6.5.

### Is there a fix for CVE-2024-39291?

Yes. Fixed in Linux 19bd9537b6bc1c882df25206c15917214d8e9460. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-39291?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/19bd9537b6bc1c882df25206c15917214d8e9460>
- patch: <https://git.kernel.org/stable/c/f1b6a016dfa45cedc080d36fa5d6f22237d80e8b>
- patch: <https://git.kernel.org/stable/c/acce6479e30f73ab0872e93a75aed1fb791d04ec>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-39291>

HTML: <https://flawdb.com/CVE-2024-39291> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-39291>
