Skip to main content

Linux Kernel CVE-2025-38398

MEDIUM
NULL Pointer Dereference (CWE-476)
2025-07-25 416baaa9-dc9f-4396-8d5f-8c081fb06d67
5.5
CVSS 3.1 · NVD
Share

Severity by source

NVD PRIMARY
5.5 MEDIUM
AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
vuln.today AI
5.5 MEDIUM

Local vector and low privilege confirmed by hardware-specific driver context; availability-only impact as heap corruption causes kernel crashes with no attacker-controlled data disclosure or write.

3.1 AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
4.0 AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE
7.8 HIGH
AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Lifecycle Timeline

2
Analysis Generated
Jul 30, 2026 - 08:55 vuln.today
CVE Published
Jul 25, 2025 - 13:15 nvd
MEDIUM 5.5

DescriptionNVD

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.

  1. 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.

AnalysisAI

Out-of-bounds heap write in the Linux kernel's spi-qpic-snand driver corrupts kernel memory on Qualcomm NAND-equipped devices, resulting in kernel panics, swiotlb mapping failures, and spinlock corruption. The flaw triggers whenever NAND flash operations require more than one codeword - a quantity determined by the chip's page size that is unknown at probe time - causing the BAM transaction buffer, allocated for only a single codeword, to be overrun. Real-world impact is denial of service via kernel crash; EPSS is 0.13% (3rd percentile), no public exploit exists, and the vulnerability is not listed in CISA KEV.

Technical ContextAI

The affected code is the Qualcomm QPIC (Qualcomm Peripheral Image Controller) Serial NAND driver in the Linux kernel SPI subsystem, identified by CPE as cpe:2.3:o:linux:linux_kernel across multiple stable branches through 6.16-rc4. The driver uses BAM (Bus Access Manager), Qualcomm's DMA engine, to issue batched descriptor transactions to NAND flash. BAM transactions are represented as a dynamically allocated structure that must be sized to hold all descriptor entries for the worst-case flash operation. During probe (qcom_nandc_alloc()), the NAND chip's page size and resulting codeword count are unknown, so the allocation covers only a single codeword. Once the NAND chip is identified and multi-codeword operations commence (e.g., full-page reads or writes), the driver indexes past the end of the allocated buffer, corrupting adjacent heap memory. The assigned CWE-476 (NULL Pointer Dereference) is an imprecise classification - the root cause is a heap out-of-bounds write (CWE-787), with NULL pointer dereference appearing only as a downstream symptom of the corrupted kernel state after reboot.

RemediationAI

Apply the upstream stable-tree patches committed at https://git.kernel.org/stable/c/86fb36de1132b560f9305f0c78fa69f459fa0980 and https://git.kernel.org/stable/c/d85d0380292a7e618915069c3579ae23c7c80339. Distribution maintainers for Qualcomm-targeted embedded Linux (e.g., OpenWrt, Yocto-based BSPs) should backport these commits to their respective stable branches. A specific patched kernel release tag is not independently confirmed from available data - only upstream git commits are referenced. As a compensating control, blacklisting or not loading the spi-qpic-snand kernel module (echo 'blacklist spi-qpic-snand' >> /etc/modprobe.d/qpic.conf) will prevent the vulnerable code from executing, but will entirely disable NAND flash access on affected hardware, making this suitable only for systems where NAND storage is non-essential. Systems not based on Qualcomm QPIC NAND hardware require no action regardless of kernel version.

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise High Availability Extension 15 SP7 Not-Affected
SUSE Linux Enterprise High Availability Extension 15 SP7 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected

Share

CVE-2025-38398 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy