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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** CRITICAL 9.4
- **CVSS:** 9.4 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: Low; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.76% (percentile 52, 2026-11-28)
- **Published:** 2024-11-19T17:19:40.912Z
- **Modified:** 2026-08-05T11:43:21.929Z

## Who should check

- Anyone running Linux \>= f748be531d7012c456b97f66091d86b3675c5fef, \< ece593fc9c00741b682869d3f3dc584d37b7c9df; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< a3ff23f7c3f0e13f718900803e090fd3997d6bc9; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 07c9c26e37542486e34d767505e842f48f29c3f6; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 58d23d835eb498336716cca55b5714191a309286; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 66600fac7a984dea4ae095411f644770b2561ede
- Anyone running Linux 4.7

## Description

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

## Affected and fixed versions

- Linux: \>= f748be531d7012c456b97f66091d86b3675c5fef, \< ece593fc9c00741b682869d3f3dc584d37b7c9df; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< a3ff23f7c3f0e13f718900803e090fd3997d6bc9; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 07c9c26e37542486e34d767505e842f48f29c3f6; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 58d23d835eb498336716cca55b5714191a309286; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 66600fac7a984dea4ae095411f644770b2561ede (cvelist)
- Linux: 4.7 (cvelist)

## Mitigation

- Upgrade Linux to 66600fac7a984dea4ae095411f644770b2561ede or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-53058. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-53058.md
Affected: Linux >= f748be531d7012c456b97f66091d86b3675c5fef, < ece593fc9c00741b682869d3f3dc584d37b7c9df; >= f748be531d7012c456b97f66091d86b3675c5fef, < a3ff23f7c3f0e13f718900803e090fd3997d6bc9; >= f748be531d7012c456b97f66091d86b3675c5fef, < 07c9c26e37542486e34d767505e842f48f29c3f6; >= f748be531d7012c456b97f6…
Fixed in: Linux 07c9c26e37542486e34d767505e842f48f29c3f6, Linux 58d23d835eb498336716cca55b5714191a309286, Linux 66600fac7a984dea4ae095411f644770b2561ede

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-53058 being exploited?

There is no confirmed exploitation: CVE-2024-53058 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.76% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2024-53058?

Critical: CVSS 9.4 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2024-53058?

Linux \>= f748be531d7012c456b97f66091d86b3675c5fef, \< ece593fc9c00741b682869d3f3dc584d37b7c9df; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< a3ff23f7c3f0e13f718900803e090fd3997d6bc9; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 07c9c26e37542486e34d767505e842f48f29c3f6; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 58d23d835eb498336716cca55b5714191a309286; \>= f748be531d7012c456b97f66091d86b3675c5fef, \< 66600fac7a984dea4ae095411f644770b2561ede; Linux 4.7.

### Is there a fix for CVE-2024-53058?

Yes. Fixed in Linux 07c9c26e37542486e34d767505e842f48f29c3f6, Linux 58d23d835eb498336716cca55b5714191a309286, Linux 66600fac7a984dea4ae095411f644770b2561ede. Upgrade Linux to 66600fac7a984dea4ae095411f644770b2561ede or later.

### How do I check if I'm affected by CVE-2024-53058?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/ece593fc9c00741b682869d3f3dc584d37b7c9df>
- patch: <https://git.kernel.org/stable/c/a3ff23f7c3f0e13f718900803e090fd3997d6bc9>
- patch: <https://git.kernel.org/stable/c/07c9c26e37542486e34d767505e842f48f29c3f6>
- patch: <https://git.kernel.org/stable/c/58d23d835eb498336716cca55b5714191a309286>
- patch: <https://git.kernel.org/stable/c/66600fac7a984dea4ae095411f644770b2561ede>
- other: <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-53058>

HTML: <https://flawdb.com/CVE-2024-53058> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-53058>
