CVE-2025-38398
published high CVSS 3.1 · 7.8spi: spi-qpic-snand: reallocate BAM transactions
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux7304d1909080ef0c9da703500a97f46c98393fcd to < 86fb36de1132b560f9305f0c78fa69f459fa0980 · 7304d1909080ef0c9da703500a97f46c98393fcd to < d85d0380292a7e618915069c3579ae23c7c80339 · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux6.15 (affected) · 0 to < 6.15 (unaffected · semver) · 6.15.6 through 6.15.* (unaffected · semver) · 6.16 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
| Amazon Linux | AL2 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
| Amazon Linux | AL2023 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
Description
In the Linux kernel, the following vulnerability has been resolved: spi: spi-qpic-snand: reallocate BAM transactions Using the mtd_nandbiterrs module for testing the driver occasionally results in weird things like below. 1. swiotlb mapping fails with the following message: [ 85.926216] qcom_snand 79b0000.spi: swiotlb buffer is full (sz: 4294967294 bytes), total 512 (slots), used 0 (slots) [ 85.932937] qcom_snand 79b0000.spi: failure in mapping desc [ 87.999314] qcom_snand 79b0000.spi: failure to write raw page [ 87.999352] mtd_nandbiterrs: error: write_oob failed (-110) Rebooting the board after this causes a panic due to a NULL pointer dereference. 2. If the swiotlb mapping does not fail, rebooting the board may result in a different panic due to a bad spinlock magic: [ 256.104459] BUG: spinlock bad magic on CPU#3, procd/2241 [ 256.104488] Unable to handle kernel paging request at virtual address ffffffff0000049b ... Investigating the issue revealed that these symptoms are results of memory corruption which is caused by out of bounds access within the driver. The driver uses a dynamically allocated structure for BAM transactions, which structure must have enough space for all possible variations of different flash operations initiated by the driver. The required space heavily depends on the actual number of 'codewords' which is calculated from the pagesize of the actual NAND chip. Although the qcom_nandc_alloc() function allocates memory for the BAM transactions during probe, but since the actual number of 'codewords' is not yet know the allocation is done for one 'codeword' only. Because of this, whenever the driver does a flash operation, and the number of the required transactions exceeds the size of the allocated arrays the driver accesses memory out of the allocated range. To avoid this, change the code to free the initially allocated BAM transactions memory, and allocate a new one once the actual number of 'codewords' required for a given NAND chip is known.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - The overflow is reached through local NAND flash I/O — filesystem reads/writes on the flash-backed UBIFS rootfs or MTD char/block device access — not through any network-facing interface. AC:L - On affected Qualcomm QPIC SPI NAND hardware the arrays are undersized by a factor of cwperpage (4 for a 2K page), so every single page read or write deterministically overruns them; there is no race and no memory-layout condition outside the attacker's control. PR:L - An unprivileged local user triggers flash page operations simply by reading files that miss the page cache on the NAND-backed filesystem; no capability check gates qcom_spi_read_page()/write_page(). UI:N - No victim action is required — the corruption occurs during the attacker's own flash I/O, and in fact happens during ordinary system operation. S:U - The out-of-bounds writes corrupt kernel heap within the same security authority; the BAM DMA is issued by the kernel itself and no VM, IOMMU, or sandbox boundary is crossed. C:H - Out-of-bounds scatterlist entries built past the allocation are consumed by the BAM DMA engine, causing DMA transfers described by adjacent heap garbage, which can disclose arbitrary kernel memory into flash buffers readable by the attacker. I:H - This is an unchecked heap out-of-bounds write of pointer-and-length scatterlist structures kilobytes past a ~2K slab object, corrupting adjacent kernel objects and steering DMA writes to attacker-influenced addresses — a strong write primitive suitable for control-flow hijacking. A:H - The corruption reliably produces kernel panics, as demonstrated by the reported swiotlb failure with a bogus 4294967294-byte size, "spinlock bad magic", and an unhandled paging request at ffffffff0000049b.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 7304d1909080ef0c9da703500a97f46c98393fcd to < 86fb36de1132b560f9305f0c78fa69f459fa0980 (affected · git)7304d1909080ef0c9da703500a97f46c98393fcd to < d85d0380292a7e618915069c3579ae23c7c80339 (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 6.15 (affected)0 to < 6.15 (unaffected · semver)6.15.6 through 6.15.* (unaffected · semver)6.16 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
2Provider assertions
1Linux · cna
spi: spi-qpic-snand: reallocate BAM transactions
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- d74ea2e721de069adb221f2efe9a2190e55a4afc29355ee08c381e489952584c
- Ingested
- 23 Sep 2026, 08:46:47 UTC
- Source record
- Official CVE record