# CVE-2026-98520: drm/amdkfd: fix use-after-free and multi-container gap in kfd\_dev\_mapping

> 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, CNA) `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.17% (percentile 3, 2026-11-26)
- **Published:** 2026-10-18T15:17:38.113Z
- **Modified:** 2026-10-24T14:16:45.950Z

## Who should check

- Anyone running Linux \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< 02b74891624e09a5512c6d84f267d01fcc306a3b; \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef
- Anyone running Linux 7.2

## Description

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

drm/amdkfd: fix use-after-free and multi-container gap in kfd\_dev\_mapping

kfd\_dev\_mapping caches the address\_space of the first /dev/kfd opener
so that the GPU reset path can call unmap\_mapping\_range() to zap all
userspace mappings of doorbell and MMIO ranges.  This design has two
bugs that both manifest under SRIOV with multiple containers:

1. Use-after-free / rwsem deadlock.  The cached pointer refers to an
   inode owned by the first opener's container.  When that container
   exits and its inode is released, kfd\_dev\_mapping becomes a dangling
   pointer.  A subsequent GPU reset dereferences it inside
   unmap\_mapping\_range(), which takes i\_mmap\_rwsem on the freed inode,
   causing a hard hang observable as an uninterruptible rwsem wait.

2. Multi-container gap.  Only the first opener's address\_space is cached;
   VMAs created by later openers live in a different address\_space and
   are never reached by unmap\_mapping\_range().  After a GPU reset those
   stale mappings keep doorbell and MMIO pages accessible to guest
   userspace with no GPU behind them, risking PCIe transaction timeouts
   and NMI panics.

Fix both bugs with the same approach used by DRM core (drm\_drv.c):
create a private pseudo-filesystem at module init time and allocate one
anonymous inode from it.  In kfd\_open() redirect every opener's
file-\>f\_mapping to that inode's address\_space.  The inode is
module-owned, lives exactly as long as the amdgpu module, and collects
VMAs from all openers in one address\_space.  A single
unmap\_mapping\_range() call in the reset path then correctly reaches
every container's mappings with no dangling pointer risk.

The hang manifests as an NMI backtrace on the GPU reset workqueue stuck
spinning in rwsem\_down\_read\_slowpath() with a corrupted i\_mmap\_rwsem:

  Workqueue: amdgpu-reset-dev xgpu\_ai\_mailbox\_flr\_work \[amdgpu\]
  Call Trace:
   \<TASK\>
   kvm\_wait+0x1f/0x40
   \_\_pv\_queued\_spin\_lock\_slowpath+0x31d/0x3a0
   \_raw\_spin\_lock\_irq+0x51/0x80
   rwsem\_down\_read\_slowpath+0xb3/0x550
   down\_read+0x48/0xd0
   unmap\_mapping\_range+0x71/0x140
   kfd\_dev\_unmap\_mapping\_range+0x5b/0x140 \[amdgpu\]
   amdgpu\_amdkfd\_clear\_kfd\_mapping+0xd8/0x190 \[amdgpu\]
   amdgpu\_device\_gpu\_recover+0x232/0x450 \[amdgpu\]
   xgpu\_ai\_mailbox\_flr\_work+0xb5/0xc0 \[amdgpu\]
   process\_one\_work+0x18e/0x3e0
   worker\_thread+0x2e3/0x420
   kthread+0x10a/0x230

(cherry picked from commit 1128b4a52de1572e87431de837fd9850cb99542c)

## Affected and fixed versions

- Linux: \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< 02b74891624e09a5512c6d84f267d01fcc306a3b; \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef (cvelist)
- Linux: 7.2 (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-2026-98520. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-98520.md
Affected: Linux >= 70cadefcc6160c575b04f763ada34c20e868d577, < 02b74891624e09a5512c6d84f267d01fcc306a3b; >= 70cadefcc6160c575b04f763ada34c20e868d577, < c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef; Linux 7.2
Fixed in: Linux 02b74891624e09a5512c6d84f267d01fcc306a3b

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-2026-98520 being exploited?

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

### How serious is CVE-2026-98520?

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

### Which versions are affected by CVE-2026-98520?

Linux \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< 02b74891624e09a5512c6d84f267d01fcc306a3b; \>= 70cadefcc6160c575b04f763ada34c20e868d577, \< c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef; Linux 7.2.

### Is there a fix for CVE-2026-98520?

Yes. Fixed in Linux 02b74891624e09a5512c6d84f267d01fcc306a3b. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2026-98520?

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

- other: <https://git.kernel.org/stable/c/02b74891624e09a5512c6d84f267d01fcc306a3b>
- other: <https://git.kernel.org/stable/c/c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef>

## 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-2026-98520>

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