# CVE-2025-21664: dm thin: make get\_first\_thin use rcu-safe list first function

- Priority: **Routine**
- Reason: Not severe (CVSS 7.8, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2025-01-21 · Modified: 2026-10-15
- Aliases: UBUNTU-CVE-2025-21664, DEBIAN-CVE-2025-21664
- Record: https://cvemate.com/vulnerability/CVE-2025-21664 · JSON: https://cvemate.com/vulnerability/CVE-2025-21664/json

## Description

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

dm thin: make get_first_thin use rcu-safe list first function

The documentation in rculist.h explains the absence of list_empty_rcu()
and cautions programmers against relying on a list_empty() ->
list_first() sequence in RCU safe code.  This is because each of these
functions performs its own READ_ONCE() of the list head.  This can lead
to a situation where the list_empty() sees a valid list entry, but the
subsequent list_first() sees a different view of list head state after a
modification.

In the case of dm-thin, this author had a production box crash from a GP
fault in the process_deferred_bios path.  This function saw a valid list
head in get_first_thin() but when it subsequently dereferenced that and
turned it into a thin_c, it got the inside of the struct pool, since the
list was now empty and referring to itself.  The kernel on which this
occurred printed both a warning about a refcount_t being saturated, and
a UBSAN error for an out-of-bounds cpuid access in the queued spinlock,
prior to the fault itself.  When the resulting kdump was examined, it
was possible to see another thread patiently waiting in thin_dtr's
synchronize_rcu.

The thin_dtr call managed to pull the thin_c out of the active thins
list (and have it be the last entry in the active_thins list) at just
the wrong moment which lead to this crash.

Fortunately, the fix here is straight forward.  Switch get_first_thin()
function to use list_first_or_null_rcu() which performs just a single
READ_ONCE() and returns NULL if the list is already empty.

This was run against the devicemapper test suite's thin-provisioning
suites for delete and suspend and no regressions were observed.
```

## Signals

- CVSS: 7.8 high (v3.1, CVE.org) CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 0.236%, percentile 15.596%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 139)

- debian linux (Debian): \< 6.1.128-1 \| \< 6.12.10-1
- ubuntu linux (Ubuntu): All versions (No fix recorded) \| \< 4.4.0-291.325 \| \< 4.15.0-261.273 \| \< 5.4.0-211.231 \| \< 5.15.0-135.146 \| \< 6.8.0-60.63
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): All versions (No fix recorded) \| \< 4.4.0-1162.168 \| \< 4.4.0-1200.215 \| \< 4.15.0-1198.211 \| \< 5.4.0-1142.152 \| \< 5.15.0-1080.87 \| \< 6.8.0-1029.31
- ubuntu linux-aws-5.0 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.15 (Ubuntu): \< 5.15.0-1080.87~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): \< 5.4.0-1142.152~18.04.1
- ubuntu linux-aws-5.8 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.2 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.5 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.8 (Ubuntu): \< 6.8.0-1029.31~22.04.1
- ubuntu linux-aws-fips (Ubuntu): \< 4.15.0-2136.142 \| All versions (No fix recorded) \| \< 5.4.0-1142.153+fips1 \| \< 5.15.0-1080.87+fips1
- ubuntu linux-aws-hwe (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1198.211~16.04.1
- ubuntu linux-azure (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1208.223~14.04.1 \| \< 4.15.0-1208.223~16.04.1 \| \< 5.4.0-1147.154 \| \< 5.15.0-1084.93 \| \< 6.8.0-1029.34
- ubuntu linux-azure-4.15 (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1208.223
- ubuntu linux-azure-5.11 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 58)

- <https://git.kernel.org/stable/c/ec037fe8c0d0f6140e3d8a49c7b29cb5582160b8>
- <https://git.kernel.org/stable/c/cd30a3960433ec2db94b3689752fa3c5df44d649>
- <https://git.kernel.org/stable/c/802666a40c71a23542c43a3f87e3a2d0f4e8fe45>
- <https://git.kernel.org/stable/c/12771050b6d059eea096993bf2001da9da9fddff>
- <https://git.kernel.org/stable/c/6b305e98de0d225ccebfb225730a9f560d28ecb0>
- <https://git.kernel.org/stable/c/cbd0d5ecfa390ac29c5380200147d09c381b2ac6>
- <https://git.kernel.org/stable/c/80f130bfad1dab93b95683fc39b87235682b8f72>
- <https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html>
- <https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html>
- <https://cert-portal.siemens.com/productcert/html/ssa-265688.html>
- <https://ubuntu.com/security/CVE-2025-21664>
- <https://www.cve.org/CVERecord?id=CVE-2025-21664>
- <https://git.kernel.org/linus/80f130bfad1dab93b95683fc39b87235682b8f72>
- <https://ubuntu.com/security/notices/USN-7379-1>
- <https://ubuntu.com/security/notices/USN-7380-1>
- <https://ubuntu.com/security/notices/USN-7381-1>
- <https://ubuntu.com/security/notices/USN-7382-1>
- <https://ubuntu.com/security/notices/USN-7387-1>
- <https://ubuntu.com/security/notices/USN-7388-1>
- <https://ubuntu.com/security/notices/USN-7389-1>

---

Data as of 2026-12-05T04:21:10.828Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
