{"id":"CVE-2026-139657","state":"PUBLISHED","title":"mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()\n\nThe !CONFIG_MMU implementation of __get_user_pages_locked() takes a bare\nget_page() reference for each page regardless of foll_flags:\n\tif (pages[i])\n\t\tget_page(pages[i]);\n\nThis is reached from pin_user_pages*() with FOLL_PIN set.\nunpin_user_page() is shared between MMU and NOMMU configurations and\nunconditionally calls gup_put_folio(..., FOLL_PIN), which subtracts\nGUP_PIN_COUNTING_BIAS (1024) from the folio refcount.\n\nThis means that pin adds 1, and then unpin will subtract 1024.\n\nIf a user maps a page (refcount 1), registers it 1023 times as an\nio_uring fixed buffer (1023 pin_user_pages calls -> refcount 1024), then\nunregisters: the first unpin_user_page subtracts 1024, refcount hits 0,\nthe page is freed and returned to the buddy allocator.  The remaining\n1022 unpins write into whatever was reallocated, and the user's VMA\nstill maps the freed page (NOMMU has no MMU to invalidate it).\nReallocating the page for an io_uring pbuf_ring then lets userspace\ncorrupt the new owner's data through the stale mapping.\n\nUse try_grab_folio() which adds GUP_PIN_COUNTING_BIAS for FOLL_PIN and 1\nfor FOLL_GET, mirroring the CONFIG_MMU path so pin and unpin are\nsymmetric. Keep supporting the traditional behavior where users specify\na pages array but don't set FOLL_GET.\n\nWhile at it, don't return NULL pointers in the page array,\nas this is really not expected for GUP users; instead, just fail and return\n-EFAULT.\n\n[ david: support traditional behavior with no FOLL_GET, extend\n  description ]","publishedAt":"2026-11-30T13:36:46.794Z","updatedAt":"2026-11-30T13:36:46.794Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"d557cd126601a73a8756b0b18e1aadfb702df67b","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"47f5b21856845382e6e0f4b74e6f93165e1f49bc","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"4dc46f3c9a44bd1a6ab41d7626abb0992283afb4","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"da01399b90a73cd00b502f7903fa5acbfac4a103","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/gup.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.7","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/gup.c"]}],"references":["https://git.kernel.org/stable/c/d557cd126601a73a8756b0b18e1aadfb702df67b","https://git.kernel.org/stable/c/47f5b21856845382e6e0f4b74e6f93165e1f49bc","https://git.kernel.org/stable/c/4dc46f3c9a44bd1a6ab41d7626abb0992283afb4","https://git.kernel.org/stable/c/da01399b90a73cd00b502f7903fa5acbfac4a103"],"weaknesses":[],"ingestedAt":"2026-11-30T13:54:04.526Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139657.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139657","state":"PUBLISHED","datePublished":"2026-11-30T13:36:46.794Z","dateUpdated":"2026-11-30T13:36:46.794Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.946Z"},"containers":{"cna":{"title":"mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()\n\nThe !CONFIG_MMU implementation of __get_user_pages_locked() takes a bare\nget_page() reference for each page regardless of foll_flags:\n\tif (pages[i])\n\t\tget_page(pages[i]);\n\nThis is reached from pin_user_pages*() with FOLL_PIN set.\nunpin_user_page() is shared between MMU and NOMMU configurations and\nunconditionally calls gup_put_folio(..., FOLL_PIN), which subtracts\nGUP_PIN_COUNTING_BIAS (1024) from the folio refcount.\n\nThis means that pin adds 1, and then unpin will subtract 1024.\n\nIf a user maps a page (refcount 1), registers it 1023 times as an\nio_uring fixed buffer (1023 pin_user_pages calls -> refcount 1024), then\nunregisters: the first unpin_user_page subtracts 1024, refcount hits 0,\nthe page is freed and returned to the buddy allocator.  The remaining\n1022 unpins write into whatever was reallocated, and the user's VMA\nstill maps the freed page (NOMMU has no MMU to invalidate it).\nReallocating the page for an io_uring pbuf_ring then lets userspace\ncorrupt the new owner's data through the stale mapping.\n\nUse try_grab_folio() which adds GUP_PIN_COUNTING_BIAS for FOLL_PIN and 1\nfor FOLL_GET, mirroring the CONFIG_MMU path so pin and unpin are\nsymmetric. Keep supporting the traditional behavior where users specify\na pages array but don't set FOLL_GET.\n\nWhile at it, don't return NULL pointers in the page array,\nas this is really not expected for GUP users; instead, just fail and return\n-EFAULT.\n\n[ david: support traditional behavior with no FOLL_GET, extend\n  description ]"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"d557cd126601a73a8756b0b18e1aadfb702df67b","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"47f5b21856845382e6e0f4b74e6f93165e1f49bc","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"4dc46f3c9a44bd1a6ab41d7626abb0992283afb4","versionType":"git"},{"version":"3faa52c03f440d1b9ddef18c4f189f4790d52d7e","status":"affected","lessThan":"da01399b90a73cd00b502f7903fa5acbfac4a103","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/gup.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.7","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/gup.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/d557cd126601a73a8756b0b18e1aadfb702df67b"},{"url":"https://git.kernel.org/stable/c/47f5b21856845382e6e0f4b74e6f93165e1f49bc"},{"url":"https://git.kernel.org/stable/c/4dc46f3c9a44bd1a6ab41d7626abb0992283afb4"},{"url":"https://git.kernel.org/stable/c/da01399b90a73cd00b502f7903fa5acbfac4a103"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:36:46.794Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}