{"id":"CVE-2026-99643","summary":"khugepaged: fix readahead lock inversion in collapse_file()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nkhugepaged: fix readahead lock inversion in collapse_file()\n\ncollapse_file() can call page_cache_sync_readahead() while still holding\nsource folios locked. If truncate holds mapping-\u003einvalidate_lock\nexclusively and waits for one of those folios, readahead waits for\ninvalidate_lock and neither side can make progress.\n\nWe need to release those folio locks before starting readahead. On a page\ncache miss, roll back first, populate the collapse range, and retry once.\nDoing readahead after rollback avoids an extra pass when all folios are\nalready present. If another miss occurs on retry, give up rather than keep\nretrying while truncate or reclaim removes folios.\n\nKeep page_cache_sync_readahead() and wait for read I/O with\nfilemap_lock_folio(), releasing each folio before moving to the next. The\nexisting uptodate check during collapse still handles read errors.\n\nShmem uses shmem_get_folio() for swapin and fallocated folios without\ntaking mapping-\u003einvalidate_lock, so it is unaffected.","modified":"2026-11-20T07:00:59.135060428Z","published":"2026-11-20T05:49:58.391Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99643.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b9b3c367faf1929fb8192a846b3604ad7eced008"},{"type":"WEB","url":"https://git.kernel.org/stable/c/eadce52a9ef657d561b3e76c9b5f178bd99735f5"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99643.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99643"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"730633f0b7f951726e87f912a6323641f674ae34"},{"fixed":"b9b3c367faf1929fb8192a846b3604ad7eced008"},{"fixed":"eadce52a9ef657d561b3e76c9b5f178bd99735f5"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99643.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.15.0"},{"fixed":"7.3.5"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99643.json"}}],"schema_version":"1.9.2"}