{"id":"CVE-2025-40270","aliases":["CVE-2025-40270"],"related":[],"kind":"vulnerability","state":"published","title":"mm, swap: fix potential UAF issue for VMA readahead","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm, swap: fix potential UAF issue for VMA readahead\n\nSince commit 78524b05f1a3 (\"mm, swap: avoid redundant swap device\npinning\"), the common helper for allocating and preparing a folio in the\nswap cache layer no longer tries to get a swap device reference\ninternally, because all callers of __read_swap_cache_async are already\nholding a swap entry reference.  The repeated swap device pinning isn't\nneeded on the same swap device.\n\nCaller of VMA readahead is also holding a reference to the target entry's\nswap device, but VMA readahead walks the page table, so it might encounter\nswap entries from other devices, and call __read_swap_cache_async on\nanother device without holding a reference to it.\n\nSo it is possible to cause a UAF when swapoff of device A raced with\nswapin on device B, and VMA readahead tries to read swap entries from\ndevice A.  It's not easy to trigger, but in theory, it could cause real\nissues.\n\nMake VMA readahead try to get the device reference first if the swap\ndevice is a different one from the target entry.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm, swap: fix potential UAF issue for VMA readahead\n\nSince commit 78524b05f1a3 (\"mm, swap: avoid redundant swap device\npinning\"), the common helper for allocating and preparing a folio in the\nswap cache layer no longer tries to get a swap device reference\ninternally, because all callers of __read_swap_cache_async are already\nholding a swap entry reference.  The repeated swap device pinning isn't\nneeded on the same swap device.\n\nCaller of VMA readahead is also holding a reference to the target entry's\nswap device, but VMA readahead walks the page table, so it might encounter\nswap entries from other devices, and call __read_swap_cache_async on\nanother device without holding a reference to it.\n\nSo it is possible to cause a UAF when swapoff of device A raced with\nswapin on device B, and VMA readahead tries to read swap entries from\ndevice A.  It's not easy to trigger, but in theory, it could cause real\nissues.\n\nMake VMA readahead try to get the device reference first if the swap\ndevice is a different one from the target entry.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido corregida:\n\nmm, swap: corregir posible problema de uso?después?de?liberación (UAF) para VMA readahead\n\nDesde el commit?'78524b05f1a3' (“mm, swap: avoid redundant swap device pinning”), el helper común para asignar y preparar un folio en la capa de caché de swap ya no intenta obtener una referencia al swap device internamente, porque todos los llamadores de '__read_swap_cache_async' ya están manteniendo una referencia a una swap entry. El pinning repetido del swap device no es necesario en el mismo swap device.\n\nEl llamador de VMA readahead también está manteniendo una referencia al swap device de la entrada objetivo, pero VMA readahead recorre la tabla de páginas, de modo que puede encontrarse con swap entries de otros dispositivos y llamar a '__read_swap_cache_async' sobre otro dispositivo sin mantener una referencia a él.\n\nPor lo tanto, es posible provocar un uso?después?de?liberación cuando 'swapoff' del dispositivo?A compite con 'swapin' en el dispositivo?B, y VMA readahead intenta leer swap entries del dispositivo?A. No es fácil de desencadenar, pero en teoría podría causar problemas reales.\n\nHacer que VMA readahead intente obtener primero la referencia al dispositivo si el swap device es diferente al del target entry.","source":"nvd"}],"published":"2025-12-06T21:50:51.639Z","modified":"2026-10-15T19:10:00.173Z","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"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"78524b05f1a3e16a5d00cc9c6259c41a9d6003ce","fixed":"a4145be7b56bfa87dce56415c3ad993071462b8a","status":"affected"},{"type":"git","introduced":"78524b05f1a3e16a5d00cc9c6259c41a9d6003ce","fixed":"1c2a936edd71e133f2806e68324ec81a4eb07588","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.15","status":"unaffected"},{"type":"semver","introduced":"6.17.9","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/a4145be7b56bfa87dce56415c3ad993071462b8a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1c2a936edd71e133f2806e68324ec81a4eb07588","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40270","url":"https://www.cve.org/CVERecord?id=CVE-2025-40270","licence":"CVE Terms of Use","modified":"2026-08-05T12:09:03.442Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40270","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40270","licence":"Public domain","modified":"2026-10-15T19:10:00.173Z"}],"updatedAt":"2026-11-25T22:59:08.373Z","epss":{"score":0.00146,"percentile":0.04025,"date":"2026-12-01T12:00:22.000Z"}}