{"id":"DEBIAN-CVE-2024-53058","details":"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-\u003etx_skbuff_dma[] will be allocated to hold extra information to be reused in stmmac_tx_clean():     tx_q-\u003etx_skbuff_dma[N + 0],     tx_q-\u003etx_skbuff_dma[N + 1],     tx_q-\u003etx_skbuff_dma[N + 2]. Now we focus on tx_q-\u003etx_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-\u003etx_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-\u003etx_skbuff_dma[entry].buf is:     tx_q-\u003etx_skbuff_dma[N + 0].buf = NULL;     tx_q-\u003etx_skbuff_dma[N + 1].buf = NULL;     tx_q-\u003etx_skbuff_dma[N + 2].buf = dma_map_single(); Unfortunately, the current code misbehaves like this:     tx_q-\u003etx_skbuff_dma[N + 0].buf = dma_map_single();     tx_q-\u003etx_skbuff_dma[N + 1].buf = NULL;     tx_q-\u003etx_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-\u003etx_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-\u003etx_skbuff_dma[entry].buf when assigning DMA buffer address.  Tested and verified on DWXGMAC CORE 3.20a","modified":"2026-09-01T20:05:35.269457016Z","published":"2024-11-19T18:15:25.767Z","upstream":["CVE-2024-53058"],"references":[{"type":"ADVISORY","url":"https://security-tracker.debian.org/tracker/CVE-2024-53058"}],"affected":[{"package":{"name":"linux","ecosystem":"Debian:12","purl":"pkg:deb/debian/linux?arch=source&distro=bookworm"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.1.119-1"}]}],"versions":["6.1.106-1","6.1.106-2","6.1.106-3","6.1.112-1","6.1.115-1","6.1.27-1","6.1.37-1","6.1.38-1","6.1.38-2","6.1.38-2~bpo11+1","6.1.38-3","6.1.38-4","6.1.38-4~bpo11+1","6.1.52-1","6.1.55-1","6.1.55-1~bpo11+1","6.1.64-1","6.1.66-1","6.1.67-1","6.1.69-1","6.1.69-1~bpo11+1","6.1.76-1","6.1.76-1~bpo11+1","6.1.82-1","6.1.85-1","6.1.90-1","6.1.90-1~bpo11+1","6.1.94-1","6.1.94-1~bpo11+1","6.1.98-1","6.1.99-1"],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2024-53058.json"}},{"package":{"name":"linux","ecosystem":"Debian:13","purl":"pkg:deb/debian/linux?arch=source&distro=trixie"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.11.7-1"}]}],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2024-53058.json"}},{"package":{"name":"linux","ecosystem":"Debian:14","purl":"pkg:deb/debian/linux?arch=source&distro=forky"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.11.7-1"}]}],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2024-53058.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"}]}