CVE-2026-90012 PUBLISHED

spi: Fix DMA mapping ownership on partial map failure

Assigner: Linux
Reserved: 11.09.2026 Published: 16.09.2026 Updated: 16.09.2026

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

spi: Fix DMA mapping ownership on partial map failure

If RX mapping fails after TX mapping succeeds, __spi_map_msg() unmaps TX but leaves tx_sg_mapped set. If TX mapping fails on a later transfer, mappings created for earlier transfers remain active.

In both cases, cur_{tx,rx}_dma_dev have not yet been updated because they are assigned only after every transfer has been mapped. The subsequent spi_unmap_msg() may therefore unmap the TX mapping again or release earlier mappings using a NULL or stale device. Using a NULL device can trigger an oops. An empty SG table does not prevent the NULL dereference because dma_unmap_sg_attrs() accesses the device before checking the entry count.

Publish both mapping devices before mapping starts and unwind all failures through __spi_unmap_msg(). This clears the mapping flags and releases each mapping once with the device that created it.

Publishing the devices before the loop also refreshes them when no transfer needs mapping. No mapping flag is set in that case, so current users do not use the pointers as mapping owners.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8

AV:N - Unauthenticated frames to a network-facing SPI NIC such as ENC28J60 or W5500 cause the driver to call spi_sync() with a multi-transfer command-plus-payload message, which reaches __spi_map_msg() in the SPI core with no local login. AC:L - The attacker decides when transfers run (packet flood) and can force a partial DMA map failure via memory or IOMMU pressure; controllers such as fsl-lpspi DMA-map even tiny transfers and MUST_TX/MUST_RX dummy buffers create the TX-then-RX failure the bug requires, with no race to win. PR:N - The SPI Ethernet receive and transmit paths run before any protocol authentication and have no capability, device-node, or namespace check, so a remote sender needs no privileges. UI:N - Once the SPI NIC is configured and up, attacker traffic alone drives spi_sync() into the mapping path; no separate victim action is required. S:U - Wrong-device or double DMA unmap and the resulting oops stay inside the host kernel DMA/IOMMU authority and do not cross a VM, guest, or other authorization boundary. C:H - On partial map failure the core leaves tx_sg_mapped set after unmapping TX, or leaves earlier live mappings active, then spi_unmap_msg() unmaps again with a NULL or stale DMA device, corrupting IOMMU bookkeeping in a way that can expose kernel memory. I:H - Double-unmap or wrong-device unmap of scatter-gather DMA mappings can alias or tear down IOVAs and allow writes into unintended kernel memory, so integrity impact is high under the required higher-severity rule. A:H - dma_unmap_sg_attrs() loads the mapping device before checking the SG entry count, so a NULL cur_{tx,rx}_dma_dev (or a NULL sgl on the IOMMU unmap path) causes a repeatable kernel oops.

Product Status

Vendor Linux
Product Linux
Versions Default: unaffected
  • affected from e289df82344fecc104ad8326b9ab6da612b9c899 to cc8354213ad6bd5fb8cc05a3fa3701188d086626 (excl.)
  • affected from e289df82344fecc104ad8326b9ab6da612b9c899 to a38051fa2ddedbc8ec15292c55e276880ec5b9a4 (excl.)
  • affected from e289df82344fecc104ad8326b9ab6da612b9c899 to 5def8b6aaad44603740786262b95b6f77df52a1c (excl.)
  • affected from e289df82344fecc104ad8326b9ab6da612b9c899 to 367cea239fc93094e5c16a72724800e0358f5c46 (excl.)
Vendor Linux
Product Linux
Versions Default: affected
  • Version 6.11 is affected
  • unaffected from 0 to 6.11 (excl.)
  • unaffected from 6.12.110 to 6.12.* (incl.)
  • unaffected from 6.18.51 to 6.18.* (incl.)
  • unaffected from 7.2.5 to 7.2.* (incl.)
  • unaffected from 7.3-rc1 to * (incl.)

References