CVE-2026-53145: drm/gem: Try to fix change_handle ioctl, attempt 4

Published Jun 25, 2026
·
Updated

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

drm/gem: Try to fix changehandle ioctl, attempt 4

[airlied: just added some comments on how to reenable] On-list because the cat is out of the bag and we're clearly not good enough to figure this out in private. The story thus far:

5e28b7b94408 ("drm: Set old handle to NULL before prime swap in changehandle") tried to fix a race condition between the gemclose and gemchangehandle ioctls, but got a few things wrong:

- There's a confusion with the local variable handle, which is actually the new handle, and so the two-stage trick was actually applied to the wrong idr slot. 7164d78559b0 ("drm/gem: fix race between changehandle and handledelete") tried to fix that by adding yet another code block, but forgot to add the error handling. Which meant we now have two paths, both kinda wrong.

- dc366607c41c ("drm: Replace old pointer to new idr") tried to apply another fix, but inconsistently, again because of the handle confusion - this would be the right fix (kinda, somewhat, it's a mess) if we'd do the two-stage approach for the new handle. Except that wasn't the intent of the original fix.

We also didn't have an igt merged for the original ioctl, which is a big no-go. This was attempted to address off-list in the original bugfix, and amd QA people claimed the bug was fixed now. Very clearly that's not the case. Here's my attempt to sort this out:

- Rename the local variable to newhandle, the old aliasing with args->handle is just too dangerously confusing.

- Merge the gem obj lookup with the two-stage idrreplace so that we avoid getting ourselves confused there.

- This means we don't have a surplus temporary reference anymore, only an inherited from the idr. A concurrent gemclose on the newhandle could steal that. Fix that with the same two-stage approach createtail uses. This is a bit overkill as documented in the comment, but I also don't trust my ability to understand this all correctly, so go with the established pattern we have from other ioctls instead for maximum paranoia.

- Adjust error paths. I've tried to make the error and success paths common, because they are identical except for which handle is removed and on which we call idrreplace to (re)install the object again. But that made things messier to read, so I've left it at the more verbose version, which unfortunately hides the symmetry in the entire code flow a bit.

- While at it, also replace the 7 space indent with 1 tab.

And finally, because I flat out don't trust my abilities here at all anymore:

- Disable the ioctl until we have the igt situation and everything else sorted out on-list and with full consensus.

v2:

Sashiko noticed that I didn't handle the error path for idrreplace correctly, it must be checked with ISERRORNULL like in gemhandledelete. So yeah, definitely should just the existing paths 1:1 because this is endless amounts of tricky.

Also add the Fixes: line for the original ioctl, I forgot that too.

Affected Software

11 affected components
Linux Kernel
Linux Linux kernel>=6.18.32<6.18.36
Linux Linux kernel>=7.0.9<7.0.13
Linux Linux kernel=7.1-rc3
Linux Linux kernel=7.1-rc4
Linux Linux kernel=7.1-rc5
Linux Linux kernel=7.1-rc6
redhat Enterprise Linux=7.0
redhat Enterprise Linux=8.0
redhat Enterprise Linux=9.0
redhat Enterprise Linux=10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch dc366607c41c
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 5e28b7b94408
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 7164d78559b0
  4. Configuration

    Fix the idr_replace error path in the existing success/error handling flows for the change_handle ioctl (Sashiko reported the error path for idr_replace was not handled).

    drm/gem change_handle ioctl idr_replace error path handling = handled
  5. Configuration

    Rename the local variable used for the new handle to new_handle and avoid confusing args->handle with the local handle; use a two-stage approach for the new handle and do not leave surplus temporary references.

    drm/gem change_handle ioctl new_handle handle usage = use new_handle for the new handle and avoid aliasing with handle
  6. Configuration

    Before the prime swap in the change_handle ioctl, set the old handle to NULL (as described: 'Set old handle to NULL before prime swap').

    drm/gem change_handle ioctl prime swap NULL assignment = set old handle to NULL before prime swap
  7. Configuration

    Fix the race between gem_close on the new_handle and idr_replace by applying the established two-stage approach for the new handle and checking with IS_ERR_OR_NULL like in existing patterns (e.g., create_tail uses it).

    drm/gem change_handle ioctl concurrent gem_close race handling = two-stage approach with IS_ERR_OR_NULL checks
  8. Configuration

    Add a Fixes: line for the original ioctl as mentioned ('And finally, because I flat out don't trust my abilities... Also add the Fixes: line for the original ioctl').

    drm/gem change_handle ioctl Fixes metadata = add Fixes: line for the original ioctl

Event History

Jun 25, 2026
CVE Published
via MITRE·08:38 AM
Data Sourced
via MITRE·08:38 AM
DescriptionSeverity
Data Sourced
via NVD·09:16 AM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via Red Hat·10:04 AM
DescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-53145?

The severity of CVE-2026-53145 is classified as high with a CVSS score of 7.8.

2

How do I fix CVE-2026-53145?

To fix CVE-2026-53145, ensure that you apply the latest patches provided by your Linux distribution.

3

What types of systems are affected by CVE-2026-53145?

CVE-2026-53145 affects the Linux kernel and, consequently, systems running Red Hat Enterprise Linux and similar Linux distributions.

4

What kind of vulnerability is CVE-2026-53145 categorized as?

CVE-2026-53145 is categorized as a race condition vulnerability.

5

What components are involved in the CVE-2026-53145 vulnerability?

The vulnerability involves the drm/gem change_handle ioctl component within the Linux kernel.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203