{"id":"CVE-2025-21664","aliases":["CVE-2025-21664"],"related":[],"kind":"vulnerability","state":"published","title":"dm thin: make get_first_thin use rcu-safe list first function","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm thin: make get_first_thin use rcu-safe list first function\n\nThe documentation in rculist.h explains the absence of list_empty_rcu()\nand cautions programmers against relying on a list_empty() ->\nlist_first() sequence in RCU safe code.  This is because each of these\nfunctions performs its own READ_ONCE() of the list head.  This can lead\nto a situation where the list_empty() sees a valid list entry, but the\nsubsequent list_first() sees a different view of list head state after a\nmodification.\n\nIn the case of dm-thin, this author had a production box crash from a GP\nfault in the process_deferred_bios path.  This function saw a valid list\nhead in get_first_thin() but when it subsequently dereferenced that and\nturned it into a thin_c, it got the inside of the struct pool, since the\nlist was now empty and referring to itself.  The kernel on which this\noccurred printed both a warning about a refcount_t being saturated, and\na UBSAN error for an out-of-bounds cpuid access in the queued spinlock,\nprior to the fault itself.  When the resulting kdump was examined, it\nwas possible to see another thread patiently waiting in thin_dtr's\nsynchronize_rcu.\n\nThe thin_dtr call managed to pull the thin_c out of the active thins\nlist (and have it be the last entry in the active_thins list) at just\nthe wrong moment which lead to this crash.\n\nFortunately, the fix here is straight forward.  Switch get_first_thin()\nfunction to use list_first_or_null_rcu() which performs just a single\nREAD_ONCE() and returns NULL if the list is already empty.\n\nThis was run against the devicemapper test suite's thin-provisioning\nsuites for delete and suspend and no regressions were observed.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm thin: make get_first_thin use rcu-safe list first function\n\nThe documentation in rculist.h explains the absence of list_empty_rcu()\nand cautions programmers against relying on a list_empty() ->\nlist_first() sequence in RCU safe code.  This is because each of these\nfunctions performs its own READ_ONCE() of the list head.  This can lead\nto a situation where the list_empty() sees a valid list entry, but the\nsubsequent list_first() sees a different view of list head state after a\nmodification.\n\nIn the case of dm-thin, this author had a production box crash from a GP\nfault in the process_deferred_bios path.  This function saw a valid list\nhead in get_first_thin() but when it subsequently dereferenced that and\nturned it into a thin_c, it got the inside of the struct pool, since the\nlist was now empty and referring to itself.  The kernel on which this\noccurred printed both a warning about a refcount_t being saturated, and\na UBSAN error for an out-of-bounds cpuid access in the queued spinlock,\nprior to the fault itself.  When the resulting kdump was examined, it\nwas possible to see another thread patiently waiting in thin_dtr's\nsynchronize_rcu.\n\nThe thin_dtr call managed to pull the thin_c out of the active thins\nlist (and have it be the last entry in the active_thins list) at just\nthe wrong moment which lead to this crash.\n\nFortunately, the fix here is straight forward.  Switch get_first_thin()\nfunction to use list_first_or_null_rcu() which performs just a single\nREAD_ONCE() and returns NULL if the list is already empty.\n\nThis was run against the devicemapper test suite's thin-provisioning\nsuites for delete and suspend and no regressions were observed.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: dm thin: hacer que get_first_thin use la función list first de rcu-safe La documentación en rculist.h explica la ausencia de list_empty_rcu() y advierte a los programadores que no confíen en una secuencia list_empty() -&gt; list_first() en el código seguro de RCU. Esto se debe a que cada una de estas funciones realiza su propio READ_ONCE() del encabezado de la lista. Esto puede llevar a una situación en la que list_empty() ve una entrada de lista válida, pero el list_first() posterior ve una vista diferente del estado del encabezado de lista después de una modificación. En el caso de dm-thin, este autor tuvo un bloqueo del cuadro de producción debido a una falla de GP en la ruta process_deferred_bios. Esta función vio un encabezado de lista válido en get_first_thin() pero cuando posteriormente desreferenciaba eso y lo convertía en un thin_c, obtuvo el interior del grupo de estructuras, ya que la lista ahora estaba vacía y se refería a sí misma. El núcleo en el que esto ocurrió imprimió una advertencia sobre la saturación de un refcount_t y un error UBSAN por un acceso a cpuid fuera de los límites en el spinlock en cola, antes del fallo en sí. Cuando se examinó el kdump resultante, fue posible ver otro hilo esperando pacientemente en elsynchronous_rcu de thin_dtr. La llamada thin_dtr logró sacar el thin_c de la lista de thins activa (y hacer que sea la última entrada en la lista de active_thins) justo en el momento equivocado, lo que provocó este bloqueo. Afortunadamente, la solución aquí es sencilla. Cambie la función get_first_thin() para usar list_first_or_null_rcu() que realiza solo un único READ_ONCE() y devuelve NULL si la lista ya está vacía. Esto se ejecutó contra las suites de aprovisionamiento fino del conjunto de pruebas devicemapper para eliminar y suspender y no se observaron regresiones.","source":"nvd"}],"published":"2025-01-21T12:18:19.015Z","modified":"2026-10-15T22:18:07.507Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"ec037fe8c0d0f6140e3d8a49c7b29cb5582160b8","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"cd30a3960433ec2db94b3689752fa3c5df44d649","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"802666a40c71a23542c43a3f87e3a2d0f4e8fe45","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"12771050b6d059eea096993bf2001da9da9fddff","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"6b305e98de0d225ccebfb225730a9f560d28ecb0","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"cbd0d5ecfa390ac29c5380200147d09c381b2ac6","status":"affected"},{"type":"git","introduced":"b10ebd34cccae1b431caf1be54919aede2be7cbe","fixed":"80f130bfad1dab93b95683fc39b87235682b8f72","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"3.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"3.15","status":"unaffected"},{"type":"semver","introduced":"5.4.290","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.234","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.177","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.125","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.72","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.10","lastAffected":"6.12.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.13","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"3.15.1","fixed":"5.4.290"},{"status":"affected","introduced":"5.5","fixed":"5.10.234"},{"status":"affected","introduced":"5.11","fixed":"5.15.177"},{"status":"affected","introduced":"5.16","fixed":"6.1.125"},{"status":"affected","introduced":"6.2","fixed":"6.6.72"},{"status":"affected","introduced":"6.7","fixed":"6.12.10"},{"status":"affected","version":"3.15"},{"status":"affected","version":"3.15"},{"status":"affected","version":"3.15"},{"status":"affected","version":"3.15"},{"status":"affected","version":"3.15"},{"status":"affected","version":"3.15"},{"status":"affected","version":"6.13"},{"status":"affected","version":"6.13"},{"status":"affected","version":"6.13"},{"status":"affected","version":"6.13"},{"status":"affected","version":"6.13"},{"status":"affected","version":"6.13"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/ec037fe8c0d0f6140e3d8a49c7b29cb5582160b8","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cd30a3960433ec2db94b3689752fa3c5df44d649","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/802666a40c71a23542c43a3f87e3a2d0f4e8fe45","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/12771050b6d059eea096993bf2001da9da9fddff","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6b305e98de0d225ccebfb225730a9f560d28ecb0","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cbd0d5ecfa390ac29c5380200147d09c381b2ac6","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/80f130bfad1dab93b95683fc39b87235682b8f72","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-265688.html","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-15T21:42:38.706Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-21664","url":"https://www.cve.org/CVERecord?id=CVE-2025-21664","licence":"CVE Terms of Use","modified":"2026-10-15T21:51:52.113Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-21664","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-21664","licence":"Public domain","modified":"2026-10-15T22:18:07.507Z"}],"updatedAt":"2026-11-25T22:58:53.455Z","epss":{"score":0.00236,"percentile":0.15629,"date":"2026-12-01T12:00:22.000Z"}}