# CVE-2024-53058: net: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data

- Priority: **Prioritise**
- Reason: Severe, CVSS 9.4 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 1% (FIRST, 04-12-2026)
- Next step: Check applicability and the vendor advisory: no fix release is recorded here
- Status: published
- Published: 2024-11-19 · Modified: 2026-08-05
- Aliases: UBUNTU-CVE-2024-53058, DEBIAN-CVE-2024-53058
- Record: https://cvemate.com/vulnerability/CVE-2024-53058 · JSON: https://cvemate.com/vulnerability/CVE-2024-53058/json

## Description

```text
In the Linux kernel, the following vulnerability has been resolved:

net: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data

In case the non-paged data of a SKB carries protocol header and protocol
payload to be transmitted on a certain platform that the DMA AXI address
width is configured to 40-bit/48-bit, or the size of the non-paged data
is bigger than TSO_MAX_BUFF_SIZE on a certain platform that the DMA AXI
address width is configured to 32-bit, then this SKB requires at least
two DMA transmit descriptors to serve it.

For example, three descriptors are allocated to split one DMA buffer
mapped from one piece of non-paged data:
    dma_desc[N + 0],
    dma_desc[N + 1],
    dma_desc[N + 2].
Then three elements of tx_q->tx_skbuff_dma[] will be allocated to hold
extra information to be reused in stmmac_tx_clean():
    tx_q->tx_skbuff_dma[N + 0],
    tx_q->tx_skbuff_dma[N + 1],
    tx_q->tx_skbuff_dma[N + 2].
Now we focus on tx_q->tx_skbuff_dma[entry].buf, which is the DMA buffer
address returned by DMA mapping call. stmmac_tx_clean() will try to
unmap the DMA buffer _ONLY_IF_ tx_q->tx_skbuff_dma[entry].buf
is a valid buffer address.

The expected behavior that saves DMA buffer address of this non-paged
data to tx_q->tx_skbuff_dma[entry].buf is:
    tx_q->tx_skbuff_dma[N + 0].buf = NULL;
    tx_q->tx_skbuff_dma[N + 1].buf = NULL;
    tx_q->tx_skbuff_dma[N + 2].buf = dma_map_single();
Unfortunately, the current code misbehaves like this:
    tx_q->tx_skbuff_dma[N + 0].buf = dma_map_single();
    tx_q->tx_skbuff_dma[N + 1].buf = NULL;
    tx_q->tx_skbuff_dma[N + 2].buf = NULL;

On the stmmac_tx_clean() side, when dma_desc[N + 0] is closed by the
DMA engine, tx_q->tx_skbuff_dma[N + 0].buf is a valid buffer address
obviously, then the DMA buffer will be unmapped immediately.
There may be a rare case that the DMA engine does not finish the
pending dma_desc[N + 1], dma_desc[N + 2] yet. Now things will go
horribly wrong, DMA is going to access a unmapped/unreferenced memory
region, corrupted data will be transmited or iommu fault will be
triggered :(

In contrast, the for-loop that maps SKB fragments behaves perfectly
as expected, and that is how the driver should do for both non-paged
data and paged frags actually.

This patch corrects DMA map/unmap sequences by fixing the array index
for tx_q->tx_skbuff_dma[entry].buf when assigning DMA buffer address.

Tested and verified on DWXGMAC CORE 3.20a
```

## Signals

- CVSS: 9.4 critical (v3.1, CVE.org) CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H
- EPSS: 0.607%, percentile 50.529%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 137)

- debian linux (Debian): \< 6.1.119-1 \| \< 6.11.7-1
- ubuntu linux (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-133.144 \| \< 6.8.0-58.60
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1078.85 \| \< 6.8.0-1027.29
- ubuntu linux-aws-5.0 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.15 (Ubuntu): \< 5.15.0-1080.87~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.8 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.2 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.5 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.8 (Ubuntu): \< 6.8.0-1027.29~22.04.1
- ubuntu linux-aws-fips (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1078.85+fips1
- ubuntu linux-aws-hwe (Ubuntu): All versions (No fix recorded)
- ubuntu linux-azure (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1081.90 \| \< 6.8.0-1027.32
- ubuntu linux-azure-4.15 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-azure-5.11 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 37)

- <https://git.kernel.org/stable/c/ece593fc9c00741b682869d3f3dc584d37b7c9df>
- <https://git.kernel.org/stable/c/a3ff23f7c3f0e13f718900803e090fd3997d6bc9>
- <https://git.kernel.org/stable/c/07c9c26e37542486e34d767505e842f48f29c3f6>
- <https://git.kernel.org/stable/c/58d23d835eb498336716cca55b5714191a309286>
- <https://git.kernel.org/stable/c/66600fac7a984dea4ae095411f644770b2561ede>
- <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>
- <https://ubuntu.com/security/CVE-2024-53058>
- <https://www.cve.org/CVERecord?id=CVE-2024-53058>
- <https://git.kernel.org/linus/66600fac7a984dea4ae095411f644770b2561ede>
- <https://ubuntu.com/security/notices/USN-7276-1>
- <https://ubuntu.com/security/notices/USN-7277-1>
- <https://ubuntu.com/security/notices/USN-7288-1>
- <https://ubuntu.com/security/notices/USN-7289-1>
- <https://ubuntu.com/security/notices/USN-7291-1>
- <https://ubuntu.com/security/notices/USN-7288-2>
- <https://ubuntu.com/security/notices/USN-7289-2>
- <https://ubuntu.com/security/notices/USN-7289-3>
- <https://ubuntu.com/security/notices/USN-7305-1>
- <https://ubuntu.com/security/notices/USN-7289-4>
- <https://ubuntu.com/security/notices/USN-7308-1>

---

Data as of 2026-12-05T06:58:04.749Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
