{"id":"CVE-2026-139099","state":"PUBLISHED","title":"net: bgmac: fix TX DMA unmapping and slot cleanup","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: bgmac: fix TX DMA unmapping and slot cleanup\n\nWhen mapping a fragment fails, bgmac_dma_tx_add() unwinds with the\nwrong slots. It passes the failed fragment's slot->dma_addr, which\nholds the mapping error, to dma_unmap_single() for the head. The\nfragment loop indexes from ring->end instead of ring->end + 1, so it\nunmaps the head a second time as a page and leaves the last mapped\nfragment mapped. None of the affected slots get their dma_addr cleared\neither, which includes the head slot when mapping the head fails.\n\nbgmac_dma_tx_ring_free() unmaps every slot with a non-zero dma_addr,\nso tearing down the ring unmaps these addresses again. It also frees\nthe skbs of pending TX slots but leaves slot->skb and slot->dma_addr\nset. The slots survive a down/up cycle, and bgmac_dma_tx_add() only\nsets slot->skb on the last slot of a packet. If a slot with a stale\npointer is later used for the head or a fragment of a scatter/gather\npacket, bgmac_dma_tx_free() frees the old skb a second time when that\nslot completes.\n\nbgmac_dma_tx_ring_free() also picks dma_unmap_single() or\ndma_unmap_page() by looking at slot->skb, which is set on the last slot\nof a packet, while the head was mapped with dma_map_single() and the\nfragments with skb_frag_dma_map().\n\nIn the error path, unmap the head and each mapped fragment from their\nown slots, and clear dma_addr on every slot the failed packet touched.\nIn bgmac_dma_tx_ring_free(), choose the unmap function by the SOF flag\nof the descriptor like bgmac_dma_tx_free() does, unmap every slot\nbefore freeing any skb, since a packet can wrap around the end of the\nring with its skb on the last slot, and clear both fields.\n\nThis was found through code inspection by an LLM while hitting other\nbugs on an Asus RT-N16. It did not hit these ones specifically.","publishedAt":"2026-11-30T13:31:34.056Z","updatedAt":"2026-11-30T13:31:34.056Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"88979640f4155bf94ffdb71e202e6f2bbb77f5c6","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"0e5a0f01e9b6cc1866305972eec902dd5f82a0ad","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"6538279222f65f05698fd7edf39b440ad2b5de35","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"e86b4724bb4d0e133cab811635d937cafc9ae5b8","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"74c41171e6dbfe33487f2314b717905a617fafef","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"1d25a2c0f491c410efc25d082a47b5e20eae91d0","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"4489cb65d52e488e60b88022b25122e887e24b6f","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"4f45e97b3aac2282f2b436d97338c9c2c484d093","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/broadcom/bgmac.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.1","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","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":["drivers/net/ethernet/broadcom/bgmac.c"]}],"references":["https://git.kernel.org/stable/c/88979640f4155bf94ffdb71e202e6f2bbb77f5c6","https://git.kernel.org/stable/c/0e5a0f01e9b6cc1866305972eec902dd5f82a0ad","https://git.kernel.org/stable/c/6538279222f65f05698fd7edf39b440ad2b5de35","https://git.kernel.org/stable/c/e86b4724bb4d0e133cab811635d937cafc9ae5b8","https://git.kernel.org/stable/c/74c41171e6dbfe33487f2314b717905a617fafef","https://git.kernel.org/stable/c/1d25a2c0f491c410efc25d082a47b5e20eae91d0","https://git.kernel.org/stable/c/4489cb65d52e488e60b88022b25122e887e24b6f","https://git.kernel.org/stable/c/4f45e97b3aac2282f2b436d97338c9c2c484d093"],"weaknesses":[],"ingestedAt":"2026-11-30T13:42:04.437Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139099.json","commit":"5317bbbde1916a58cb1fadabb726eb126daf44c1","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139099","state":"PUBLISHED","datePublished":"2026-11-30T13:31:34.056Z","dateUpdated":"2026-11-30T13:31:34.056Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.914Z"},"containers":{"cna":{"title":"net: bgmac: fix TX DMA unmapping and slot cleanup","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: bgmac: fix TX DMA unmapping and slot cleanup\n\nWhen mapping a fragment fails, bgmac_dma_tx_add() unwinds with the\nwrong slots. It passes the failed fragment's slot->dma_addr, which\nholds the mapping error, to dma_unmap_single() for the head. The\nfragment loop indexes from ring->end instead of ring->end + 1, so it\nunmaps the head a second time as a page and leaves the last mapped\nfragment mapped. None of the affected slots get their dma_addr cleared\neither, which includes the head slot when mapping the head fails.\n\nbgmac_dma_tx_ring_free() unmaps every slot with a non-zero dma_addr,\nso tearing down the ring unmaps these addresses again. It also frees\nthe skbs of pending TX slots but leaves slot->skb and slot->dma_addr\nset. The slots survive a down/up cycle, and bgmac_dma_tx_add() only\nsets slot->skb on the last slot of a packet. If a slot with a stale\npointer is later used for the head or a fragment of a scatter/gather\npacket, bgmac_dma_tx_free() frees the old skb a second time when that\nslot completes.\n\nbgmac_dma_tx_ring_free() also picks dma_unmap_single() or\ndma_unmap_page() by looking at slot->skb, which is set on the last slot\nof a packet, while the head was mapped with dma_map_single() and the\nfragments with skb_frag_dma_map().\n\nIn the error path, unmap the head and each mapped fragment from their\nown slots, and clear dma_addr on every slot the failed packet touched.\nIn bgmac_dma_tx_ring_free(), choose the unmap function by the SOF flag\nof the descriptor like bgmac_dma_tx_free() does, unmap every slot\nbefore freeing any skb, since a packet can wrap around the end of the\nring with its skb on the last slot, and clear both fields.\n\nThis was found through code inspection by an LLM while hitting other\nbugs on an Asus RT-N16. It did not hit these ones specifically."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"88979640f4155bf94ffdb71e202e6f2bbb77f5c6","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"0e5a0f01e9b6cc1866305972eec902dd5f82a0ad","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"6538279222f65f05698fd7edf39b440ad2b5de35","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"e86b4724bb4d0e133cab811635d937cafc9ae5b8","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"74c41171e6dbfe33487f2314b717905a617fafef","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"1d25a2c0f491c410efc25d082a47b5e20eae91d0","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"4489cb65d52e488e60b88022b25122e887e24b6f","versionType":"git"},{"version":"9cde94506eacfcda570b6c304b8deae1a7191ee2","status":"affected","lessThan":"4f45e97b3aac2282f2b436d97338c9c2c484d093","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/broadcom/bgmac.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.1","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","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":["drivers/net/ethernet/broadcom/bgmac.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/88979640f4155bf94ffdb71e202e6f2bbb77f5c6"},{"url":"https://git.kernel.org/stable/c/0e5a0f01e9b6cc1866305972eec902dd5f82a0ad"},{"url":"https://git.kernel.org/stable/c/6538279222f65f05698fd7edf39b440ad2b5de35"},{"url":"https://git.kernel.org/stable/c/e86b4724bb4d0e133cab811635d937cafc9ae5b8"},{"url":"https://git.kernel.org/stable/c/74c41171e6dbfe33487f2314b717905a617fafef"},{"url":"https://git.kernel.org/stable/c/1d25a2c0f491c410efc25d082a47b5e20eae91d0"},{"url":"https://git.kernel.org/stable/c/4489cb65d52e488e60b88022b25122e887e24b6f"},{"url":"https://git.kernel.org/stable/c/4f45e97b3aac2282f2b436d97338c9c2c484d093"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:31:34.056Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}