{"id":"CVE-2021-46988","aliases":["CVE-2021-46988"],"related":[],"kind":"vulnerability","state":"published","title":"userfaultfd: release page in error path to avoid BUG_ON","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nuserfaultfd: release page in error path to avoid BUG_ON\n\nConsider the following sequence of events:\n\n1. Userspace issues a UFFD ioctl, which ends up calling into\n   shmem_mfill_atomic_pte(). We successfully account the blocks, we\n   shmem_alloc_page(), but then the copy_from_user() fails. We return\n   -ENOENT. We don't release the page we allocated.\n2. Our caller detects this error code, tries the copy_from_user() after\n   dropping the mmap_lock, and retries, calling back into\n   shmem_mfill_atomic_pte().\n3. Meanwhile, let's say another process filled up the tmpfs being used.\n4. So shmem_mfill_atomic_pte() fails to account blocks this time, and\n   immediately returns - without releasing the page.\n\nThis triggers a BUG_ON in our caller, which asserts that the page\nshould always be consumed, unless -ENOENT is returned.\n\nTo fix this, detect if we have such a \"dangling\" page when accounting\nfails, and if so, release it before returning.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nuserfaultfd: release page in error path to avoid BUG_ON\n\nConsider the following sequence of events:\n\n1. Userspace issues a UFFD ioctl, which ends up calling into\n   shmem_mfill_atomic_pte(). We successfully account the blocks, we\n   shmem_alloc_page(), but then the copy_from_user() fails. We return\n   -ENOENT. We don't release the page we allocated.\n2. Our caller detects this error code, tries the copy_from_user() after\n   dropping the mmap_lock, and retries, calling back into\n   shmem_mfill_atomic_pte().\n3. Meanwhile, let's say another process filled up the tmpfs being used.\n4. So shmem_mfill_atomic_pte() fails to account blocks this time, and\n   immediately returns - without releasing the page.\n\nThis triggers a BUG_ON in our caller, which asserts that the page\nshould always be consumed, unless -ENOENT is returned.\n\nTo fix this, detect if we have such a \"dangling\" page when accounting\nfails, and if so, release it before returning.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se resolvió la siguiente vulnerabilidad: userfaultfd: publicar página en ruta de error para evitar BUG_ON Considere la siguiente secuencia de eventos: 1. Userspace emite un ioctl UFFD, que termina llamando a shmem_mfill_atomic_pte(). Contamos con éxito los bloques, usamos shmem_alloc_page(), pero luego copy_from_user() falla. Volvemos -ENOENT. No publicamos la página que asignamos. 2. Nuestra persona que llama detecta este código de error, intenta copiar_from_user() después de descartar mmap_lock y vuelve a intentarlo, volviendo a llamar a shmem_mfill_atomic_pte(). 3. Mientras tanto, digamos que otro proceso llenó los tmpfs que se estaban utilizando. 4. Entonces shmem_mfill_atomic_pte() no logra bloquear la cuenta esta vez y regresa inmediatamente, sin liberar la página. Esto desencadena un BUG_ON en nuestra persona que llama, que afirma que la página siempre debe consumirse, a menos que se devuelva -ENOENT. Para solucionar este problema, detectar si tenemos esa página \"colgante\" cuando falla la contabilidad y, en caso afirmativo, liberarla antes de regresar.","source":"nvd"}],"published":"2024-02-28T08:13:15.310Z","modified":"2026-06-17T04:16:05.530Z","severity":{"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"},"severities":[{"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":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"319116227e52d49eee671f0aa278bac89b3c1b69","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"07c9b834c97d0fa3402fb7f3f3b32df370a6ff1f","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"b3f1731c6d7fbc1ebe3ed8eff6d6bec56d76ff43","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"140cfd9980124aecb6c03ef2e69c72d0548744de","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"ad53127973034c63b5348715a1043d0e80ceb330","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"2d59a0ed8b26b8f3638d8afc31f839e27759f1f6","status":"affected"},{"type":"git","introduced":"cb658a453b9327ce96ce5222c24d162b5b65b564","fixed":"7ed9d238c7dbb1fdb63ad96a6184985151b0171c","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.11","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.11","status":"unaffected"},{"type":"semver","introduced":"4.14.233","lastAffected":"4.14.*","status":"unaffected"},{"type":"semver","introduced":"4.19.191","lastAffected":"4.19.*","status":"unaffected"},{"type":"semver","introduced":"5.4.120","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.38","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.11.22","lastAffected":"5.11.*","status":"unaffected"},{"type":"semver","introduced":"5.12.5","lastAffected":"5.12.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"5.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":"4.11","fixed":"4.14.233"},{"status":"affected","introduced":"4.15","fixed":"4.19.191"},{"status":"affected","introduced":"4.20","fixed":"5.4.120"},{"status":"affected","introduced":"5.5","fixed":"5.10.38"},{"status":"affected","introduced":"5.11","fixed":"5.11.22"},{"status":"affected","introduced":"5.12","fixed":"5.12.5"},{"status":"affected","version":"5.13"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/319116227e52d49eee671f0aa278bac89b3c1b69","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/07c9b834c97d0fa3402fb7f3f3b32df370a6ff1f","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/b3f1731c6d7fbc1ebe3ed8eff6d6bec56d76ff43","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/140cfd9980124aecb6c03ef2e69c72d0548744de","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ad53127973034c63b5348715a1043d0e80ceb330","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2d59a0ed8b26b8f3638d8afc31f839e27759f1f6","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/7ed9d238c7dbb1fdb63ad96a6184985151b0171c","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-06-21T16:28:01.611Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-46988","url":"https://www.cve.org/CVERecord?id=CVE-2021-46988","licence":"CVE Terms of Use","modified":"2026-05-11T13:45:47.021Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-46988","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-46988","licence":"Public domain","modified":"2026-06-17T04:16:05.530Z"}],"updatedAt":"2026-11-25T22:58:08.603Z","epss":{"score":0.0024,"percentile":0.16166,"date":"2026-12-01T12:00:22.000Z"}}