{"api_version":"1","generated_at":"2026-12-02T03:08:57+00:00","cve":"CVE-2026-139460","urls":{"html":"https://cve.report/CVE-2026-139460","api":"https://cve.report/api/cve/CVE-2026-139460.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139460","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139460"},"summary":{"title":"PCI/P2PDMA: Do not tear down the allocate attribute on registration failure","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nPCI/P2PDMA: Do not tear down the allocate attribute on registration failure\n\npci_p2pdma_add_resource() installs pci_p2pdma_unmap_mappings() as a devres\naction with the devres allocated p2p_pgmap as its data, and only then adds\nthe range to the pool:\n\n  error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings,\n                                   p2p_pgmap);\n  if (error)\n          goto pages_free;\n\n  p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);\n  error = gen_pool_add_owner(p2pdma->pool, ...);\n  if (error)\n          goto pages_free;\n\nThe action removes the allocate attribute for the whole device, which tears\ndown existing userspace mappings of every BAR already registered on it.\nBoth failures here get that wrong, in opposite ways.\n\ndevm_add_action_or_reset() runs the action when it cannot allocate its\ndevres node, so an -ENOMEM while registering a second BAR unmaps the first\none. Use devm_add_action() and let the error path unwind only what this\ncall created.\n\ngen_pool_add_owner() allocates a chunk and can also fail with -ENOMEM.\nThere the action is registered, and the error path frees p2p_pgmap with\ndevm_kfree() while leaving the action pointing at it. On unbind devres\nruns the action and pci_p2pdma_unmap_mappings() dereferences\np2p_pgmap->mem->owner->kobj, which is freed memory. Give that failure its\nown label and drop the action with devm_remove_action(), which removes it\nwithout running it.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:19:17","updated_at":"2026-11-30 14:19:17"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/ea24957f8be21b0724fcb968b73860257b718b63","name":"https://git.kernel.org/stable/c/ea24957f8be21b0724fcb968b73860257b718b63","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/29a3a087228b372b9e7ebaf363550e4a1c95ba61","name":"https://git.kernel.org/stable/c/29a3a087228b372b9e7ebaf363550e4a1c95ba61","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/7c4d6505a1f8a1ebe8019b7f988ed494b696653b","name":"https://git.kernel.org/stable/c/7c4d6505a1f8a1ebe8019b7f988ed494b696653b","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/4fea96c997265874cfa1788494f9ce2d413b6d92","name":"https://git.kernel.org/stable/c/4fea96c997265874cfa1788494f9ce2d413b6d92","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139460","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139460","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 ea24957f8be21b0724fcb968b73860257b718b63 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 4fea96c997265874cfa1788494f9ce2d413b6d92 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 29a3a087228b372b9e7ebaf363550e4a1c95ba61 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 7c4d6505a1f8a1ebe8019b7f988ed494b696653b git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.2","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.2 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.120 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.65 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.6 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["drivers/pci/p2pdma.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"ea24957f8be21b0724fcb968b73860257b718b63","status":"affected","version":"7e9c7ef83d785236f5a8c3761dd053fae9b92fb8","versionType":"git"},{"lessThan":"4fea96c997265874cfa1788494f9ce2d413b6d92","status":"affected","version":"7e9c7ef83d785236f5a8c3761dd053fae9b92fb8","versionType":"git"},{"lessThan":"29a3a087228b372b9e7ebaf363550e4a1c95ba61","status":"affected","version":"7e9c7ef83d785236f5a8c3761dd053fae9b92fb8","versionType":"git"},{"lessThan":"7c4d6505a1f8a1ebe8019b7f988ed494b696653b","status":"affected","version":"7e9c7ef83d785236f5a8c3761dd053fae9b92fb8","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["drivers/pci/p2pdma.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"6.2"},{"lessThan":"6.2","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.120","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.65","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.6","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.120","versionStartIncluding":"6.2","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.65","versionStartIncluding":"6.2","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6","versionStartIncluding":"6.2","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"6.2","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nPCI/P2PDMA: Do not tear down the allocate attribute on registration failure\n\npci_p2pdma_add_resource() installs pci_p2pdma_unmap_mappings() as a devres\naction with the devres allocated p2p_pgmap as its data, and only then adds\nthe range to the pool:\n\n  error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings,\n                                   p2p_pgmap);\n  if (error)\n          goto pages_free;\n\n  p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);\n  error = gen_pool_add_owner(p2pdma->pool, ...);\n  if (error)\n          goto pages_free;\n\nThe action removes the allocate attribute for the whole device, which tears\ndown existing userspace mappings of every BAR already registered on it.\nBoth failures here get that wrong, in opposite ways.\n\ndevm_add_action_or_reset() runs the action when it cannot allocate its\ndevres node, so an -ENOMEM while registering a second BAR unmaps the first\none. Use devm_add_action() and let the error path unwind only what this\ncall created.\n\ngen_pool_add_owner() allocates a chunk and can also fail with -ENOMEM.\nThere the action is registered, and the error path frees p2p_pgmap with\ndevm_kfree() while leaving the action pointing at it. On unbind devres\nruns the action and pci_p2pdma_unmap_mappings() dereferences\np2p_pgmap->mem->owner->kobj, which is freed memory. Give that failure its\nown label and drop the action with devm_remove_action(), which removes it\nwithout running it."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:34:57.583Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/ea24957f8be21b0724fcb968b73860257b718b63"},{"url":"https://git.kernel.org/stable/c/4fea96c997265874cfa1788494f9ce2d413b6d92"},{"url":"https://git.kernel.org/stable/c/29a3a087228b372b9e7ebaf363550e4a1c95ba61"},{"url":"https://git.kernel.org/stable/c/7c4d6505a1f8a1ebe8019b7f988ed494b696653b"}],"title":"PCI/P2PDMA: Do not tear down the allocate attribute on registration failure","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139460","datePublished":"2026-11-30T13:34:57.583Z","dateReserved":"2026-11-30T13:22:15.935Z","dateUpdated":"2026-11-30T13:34:57.583Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:19:17","lastModifiedDate":"2026-11-30 14:19:17","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139460","Ordinal":"1","Title":"PCI/P2PDMA: Do not tear down the allocate attribute on registrat","CVE":"CVE-2026-139460","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139460","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nPCI/P2PDMA: Do not tear down the allocate attribute on registration failure\n\npci_p2pdma_add_resource() installs pci_p2pdma_unmap_mappings() as a devres\naction with the devres allocated p2p_pgmap as its data, and only then adds\nthe range to the pool:\n\n  error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings,\n                                   p2p_pgmap);\n  if (error)\n          goto pages_free;\n\n  p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);\n  error = gen_pool_add_owner(p2pdma->pool, ...);\n  if (error)\n          goto pages_free;\n\nThe action removes the allocate attribute for the whole device, which tears\ndown existing userspace mappings of every BAR already registered on it.\nBoth failures here get that wrong, in opposite ways.\n\ndevm_add_action_or_reset() runs the action when it cannot allocate its\ndevres node, so an -ENOMEM while registering a second BAR unmaps the first\none. Use devm_add_action() and let the error path unwind only what this\ncall created.\n\ngen_pool_add_owner() allocates a chunk and can also fail with -ENOMEM.\nThere the action is registered, and the error path frees p2p_pgmap with\ndevm_kfree() while leaving the action pointing at it. On unbind devres\nruns the action and pci_p2pdma_unmap_mappings() dereferences\np2p_pgmap->mem->owner->kobj, which is freed memory. Give that failure its\nown label and drop the action with devm_remove_action(), which removes it\nwithout running it.","Type":"Description","Title":"PCI/P2PDMA: Do not tear down the allocate attribute on registrat"}]}}}