{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2024-53058","id":"CVE-2024-53058","title":"net: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data\n\nIn case the non-paged data of a SKB carries protocol header and protocol\npayload to be transmitted on a certain platform that the DMA AXI address\nwidth is configured to 40-bit/48-bit, or the size of the non-paged data\nis bigger than TSO_MAX_BUFF_SIZE on a cert","descriptionLong":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data\n\nIn case the non-paged data of a SKB carries protocol header and protocol\npayload to be transmitted on a certain platform that the DMA AXI address\nwidth is configured to 40-bit/48-bit, or the size of the non-paged data\nis bigger than TSO_MAX_BUFF_SIZE on a certain platform that the DMA AXI\naddress width is configured to 32-bit, then this SKB requires at least\ntwo DMA transmit descriptors to serve it.\n\nFor example, three descriptors are allocated to split one DMA buffer\nmapped from one piece of non-paged data:\n    dma_desc[N + 0],\n    dma_desc[N + 1],\n    dma_desc[N + 2].\nThen three elements of tx_q->tx_skbuff_dma[] will be allocated to hold\nextra information to be reused in stmmac_tx_clean():\n    tx_q->tx_skbuff_dma[N + 0],\n    tx_q->tx_skbuff_dma[N + 1],\n    tx_q->tx_skbuff_dma[N + 2].\nNow we focus on tx_q->tx_skbuff_dma[entry].buf, which is the DMA buffer\naddress returned by DMA mapping call. stmmac_tx_clean() will try to\nunmap the DMA buffer _ONLY_IF_ tx_q->tx_skbuff_dma[entry].buf\nis a valid buffer address.\n\nThe expected behavior that saves DMA buffer address of this non-paged\ndata to tx_q->tx_skbuff_dma[entry].buf is:\n    tx_q->tx_skbuff_dma[N + 0].buf = NULL;\n    tx_q->tx_skbuff_dma[N + 1].buf = NULL;\n    tx_q->tx_skbuff_dma[N + 2].buf = dma_map_single();\nUnfortunately, the current code misbehaves like this:\n    tx_q->tx_skbuff_dma[N + 0].buf = dma_map_single();\n    tx_q->tx_skbuff_dma[N + 1].buf = NULL;\n    tx_q->tx_skbuff_dma[N + 2].buf = NULL;\n\nOn the stmmac_tx_clean() side, when dma_desc[N + 0] is closed by the\nDMA engine, tx_q->tx_skbuff_dma[N + 0].buf is a valid buffer address\nobviously, then the DMA buffer will be unmapped immediately.\nThere may be a rare case that the DMA engine does not finish the\npending dma_desc[N + 1], dma_desc[N + 2] yet. Now things will go\nhorribly wrong, DMA is going to access a unmapped/unreferenced memory\nregion, corrupted data will be transmited or iommu fault will be\ntriggered :(\n\nIn contrast, the for-loop that maps SKB fragments behaves perfectly\nas expected, and that is how the driver should do for both non-paged\ndata and paged frags actually.\n\nThis patch corrects DMA map/unmap sequences by fixing the array index\nfor tx_q->tx_skbuff_dma[entry].buf when assigning DMA buffer address.\n\nTested and verified on DWXGMAC CORE 3.20a","published":"2024-11-19T17:19:40.912Z","updated":"2026-10-28T02:30:25.480317152Z","reserved":"2024-11-19T17:17:24.974Z","status":"Modified","rejected":false,"assigner":"Linux","metric":{"version":"3.1","score":9.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","rating":"critical","source":"Linux"},"metrics":[{"version":"3.1","score":9.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","rating":"critical","source":"Linux"},{"version":"3.1","score":9.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","rating":"critical","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"version":"3.1","score":5.5,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","rating":"medium","source":"NVD"},{"version":"3.1","score":5.5,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","rating":"medium","source":"CISA-ADP"},{"version":"3.1","score":9.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","rating":"critical","source":"OSV"}],"rating":"critical","products":["Linux"],"affectedProducts":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f748be531d7012c456b97f66091d86b3675c5fef","lessThan":"ece593fc9c00741b682869d3f3dc584d37b7c9df","status":"affected","versionType":"git"},{"version":"f748be531d7012c456b97f66091d86b3675c5fef","lessThan":"a3ff23f7c3f0e13f718900803e090fd3997d6bc9","status":"affected","versionType":"git"},{"version":"f748be531d7012c456b97f66091d86b3675c5fef","lessThan":"07c9c26e37542486e34d767505e842f48f29c3f6","status":"affected","versionType":"git"},{"version":"f748be531d7012c456b97f66091d86b3675c5fef","lessThan":"58d23d835eb498336716cca55b5714191a309286","status":"affected","versionType":"git"},{"version":"f748be531d7012c456b97f66091d86b3675c5fef","lessThan":"66600fac7a984dea4ae095411f644770b2561ede","status":"affected","versionType":"git"}],"platforms":[]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.7","status":"affected"},{"version":"0","lessThan":"4.7","status":"unaffected","versionType":"semver"},{"version":"5.15.171","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"6.1.116","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.60","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.11.7","lessThanOrEqual":"6.11.*","status":"unaffected","versionType":"semver"},{"version":"6.12","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}],"platforms":[]}],"packages":[],"cwes":[],"aliases":[],"references":[{"url":"https://git.kernel.org/stable/c/ece593fc9c00741b682869d3f3dc584d37b7c9df","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/a3ff23f7c3f0e13f718900803e090fd3997d6bc9","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/07c9c26e37542486e34d767505e842f48f29c3f6","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/58d23d835eb498336716cca55b5714191a309286","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/66600fac7a984dea4ae095411f644770b2561ede","tags":["Patch","web"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html","tags":["web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/53xxx/CVE-2024-53058.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-53058","tags":["advisory"]},{"url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","tags":["package"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial"},"epss":0.00607,"epssPercentile":0.5,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2024-53058","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-53058","ok":true,"note":"Modified"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2024-53058","ok":true,"note":"0 packages"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2024-53058","ok":true,"note":"scored 2026-11-20"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}