HIGH
amdgpu Fence UAF
CVE-2026-31566
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.8HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: drm/amdgpu: Fix fence put before wait in amdgpu_amdkfd_submit_ib amdgpu_amdkfd_submit_ib() submits a GPU job and gets a fence from amdgpu_ib_schedule(). This fence is used to wait for job completion. Currently, the code drops the fence reference using dma_fence_put() before calling dma_fence_wait(). If dma_fence_put() releases the last reference, the fence may be freed before dma_fence_wait() is called. This can lead to a use-after-free. Fix this by waiting on the fence first and releasing the reference only after dma_fence_wait() completes. Fixes the below: drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:697 amdgpu_amdkfd_submit_ib() warn: passing freed memory 'f' (line 696) (cherry picked from commit 8b9e5259adc385b61a6590a13b82ae0ac2bd3482)
02KernelScan AI Analysis
Risk summary
An attacker with local access to AMD GPU hardware could potentially trigger a use-after-free condition when submitting GPU jobs, potentially leading to system crashes or privilege escalation. The vulnerability requires local access and the ability to interact with GPU devices.
Vulnerability analysis
Summary: Use-after-free vulnerability in AMD GPU driver fence handling
Root Cause: The amdgpu_amdkfd_submit_ib() function incorrectly releases a fence reference with dma_fence_put() before calling dma_fence_wait() on the same fence. If dma_fence_put() releases the last reference, the fence object is freed, causing dma_fence_wait() to access freed memory.
Attack Surface: Local attack surface requiring access to AMD GPU hardware and the ability to submit GPU jobs through the AMDKFD interface. Requires local access with sufficient privileges to interact with GPU devices.
Fix Mechanism: The patch reorders the operations to call dma_fence_wait() first, then dma_fence_put() after the wait completes. This ensures the fence object remains valid during the wait operation by maintaining the reference count until after use.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.1 | 6.1.168 | bc7760c107dc |
| 6.12 | 6.12.80 | 138e42be35ff |
| 6.18 | 6.18.21 | 39820864eacd |
| 6.19 | 6.19.11 | 42d248726a08 |
| 6.6 | 6.6.131 | e23602eb0779 |
| mainline | 7.0 | 7150850146eb |