CVE-2026-99000: drm/xe: Fix shrinker accounting double-subtraction on nested external pins

Published Oct 23, 2026
·
Updated

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

drm/xe: Fix shrinker accounting double-subtraction on nested external pins

xebopinexternal() and xebounpinexternal() support nested pins, since the underlying ttmbopin()/ttmbounpin() maintain a pincount refcount rather than a boolean. However, the shrinker accounting calls xettmttaccountsubtract() and xettmttaccountadd() are invoked unconditionally on every pinexternal()/unpinexternal() call, instead of only on the transition into and out of the pinned state.

An external BO (dma-buf) can be pinned more than once while already pinned, for example when it has multiple attachments/importers, each independently calling xebopinexternal(). Each such nested pin subtracts the BO's pages from the shrinker's accounting again, even though the BO's pages were already removed from consideration by the first pin. Symmetrically, each nested unpin adds them back again before the BO is actually unpinned. This desynchronizes the shrinker's page and object counts from reality, and since they are declared as signed long but interpreted as unsigned long in xeshrinkercount(), the underflow can turn into an enormous shrinkable/purgeable page count, causing the shrinker to be invoked excessively under memory pressure.

Guard the accounting calls with the same pin-count transition checks already used to guard the pinnedlink list maintenance, so accounting is only updated on the outermost pin and the final unpin.

While centralizing this logic into xeboaccountpin()/ xeboaccountunpin(), also close a second, related accounting gap affecting imported dma-bufs. For an imported bo's ttmtt, xe's ttmttpopulate hook (xettmttpopulate()) early-returns without calling xettmttaccountadd(), since TTMTTFLAGEXTERNAL is set without TTMTTFLAGEXTERNALMAPPABLE. However, TTM core's ttmttpopulate() wrapper unconditionally marks the tt as populated on driver-hook success, so ttmttispopulated() still reports true for it. xeboaccountpin()/xeboaccountunpin() trusted ttmttispopulated() as a proxy for "these pages are accounted for by the shrinker", and would subtract/add pages for such a tt that were never added in the first place, again underflowing the shrinker's counts. This is reachable today via xebopinexternal(), and would have become newly reachable via the fb-pin path once this patch routes xepinfbvma() through xebopinaccount() below, so fix it here rather than in a later patch, to avoid a commit in this series that introduces the regression before fixing it. Skip the accounting for imported bos, using the same EXTERNAL && !EXTERNALMAPPABLE test xettmttpopulate()/xettmttunpopulate() use to decide whether to act, via a new xettmboisimported() helper (hoisted up from its only prior use site).

v2: - Fix the critical issue caught by Sashiko AI review: the pin-count transition check introduced here was still bypassed by the fb-pin path (xepinfbvma()/xeunpinfbvma()), which could leave a stale pinnedlink entry and a permanent shrinker accounting leak when the fb-unpin performed the true last unpin. Addressed in a separate follow-up patch in this series rather than folded in here, since it is a distinct bug with its own Fixes: tag. - Drop the unneeded local "lastunpin" variable in xebounpinexternal(), restoring the original inline bo->ttm.pincount == 1 check; it was a no-op rename not used by any of the new accounting helpers, and was going to be deleted again by the follow-up patch anyway.

v3: - Exclude imported dma-bufs from the pin/unpin shrinker accounting, fixing another underflow caught by Sashiko AI review. - Add a short comment on the backup-object pin site noting it's already populated/accounted at pin time, addressing (as a false-positive clarification, no code fix needed) a separate Medium-severity accounting-leak concern also caught by Sashiko AI ---truncated---

Affected Software

1 affected component
Linux Linux kernel

Event History

Oct 23, 2026
CVE Published
via MITRE·12:20 PM
Data Sourced
via MITRE·12:20 PM
Description

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