KernelScan.io

HIGH

drm GemHandle UAF

CVE-2026-46215

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.9MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: drm: Set old handle to NULL before prime swap in change_handle There was a potential race condition in change_handle. The ioctl briefly had a single object with two idr entries; a concurrent gem_close could delete the object and remove one of the handles while leaving the other one dangling, which could subsequently be dereferenced for a use-after-free. To fix this, do the same dance that gem_close itself does. (f6cd7daecff5 drm: Release driver references to handle before making it available again) First idr_replace the old handle to NULL. Later, if the prime operations are successful, actually close it. create_tail required a similar dance to avoid a similar problem. (bd46cece51a3 drm/gem: Fix race in drm_gem_handle_create_tail()) It idr_allocs the new handle with NULL, then swaps in the correct object later to avoid races. We don't need to do that here, since the only operations that could race are drm_prime, and change_handle holds the prime lock for the entire duration. v2: cleanups of error paths

02

Engine v0.2.0

Risk summary

Local users with graphics device access can trigger a use-after-free in the DRM GEM handle management code via a race between handle reassignment and gem close, potentially leading to privilege escalation, information disclosure, or system crash. The vulnerability affects systems where untrusted code or tenants can access DRM/GPU interfaces.

Affecteddrivers/gpu/drm/drm_gem.c (DRM graphics)

Vulnerability analysis

The root cause is a race condition in drm_gem_change_handle_ioctl. After allocating a new IDR handle pointing to the target GEM object, the ioctl releases the object table lock before performing prime bookkeeping and deleting the old handle. During this window, a concurrent gem_close on the old handle can drop the object's last reference, freeing it while the new handle still points to it. Subsequent dereference of the dangling handle results in a use-after-free. The fix closes the race by first replacing the old handle with NULL under the table lock, then performing prime operations, and only closing the old handle after confirming success.

03

BranchFixed inPatch commit
6.186.18.32672464dd5323
7.07.0.961bd96d3e547
mainline7.1-rc35e28b7b94408