CVE-2026-31649: net: stmmac: fix integer underflow in chain mode
In the Linux kernel, the following vulnerability has been resolved:
net: stmmac: fix integer underflow in chain mode
The jumbofrm() chain-mode implementation unconditionally computes
len = nopagedlen - bmax;
where nopagedlen = skbheadlen(skb) (linear bytes only) and bmax is BUFSIZE8KiB or BUFSIZE2KiB. However, the caller stmmacxmit() decides to invoke jumbofrm() based on skb->len (total length including page fragments):
isjumbo = stmmacisjumbofrm(priv, skb->len, enhdesc);
When a packet has a small linear portion (nopagedlen <= bmax) but a large total length due to page fragments (skb->len > bmax), the subtraction wraps as an unsigned integer, producing a huge len value (~0xFFFFxxxx). This causes the while (len != 0) loop to execute hundreds of thousands of iterations, passing skb->data + bmax i pointers far beyond the skb buffer to dmamapsingle(). On IOMMU-less SoCs (the typical deployment for stmmac), this maps arbitrary kernel memory to the DMA engine, constituting a kernel memory disclosure and potential memory corruption from hardware.
Fix this by introducing a buflen local variable clamped to min(nopagedlen, bmax). Computing len = nopagedlen - buflen is then always safe: it is zero when the linear portion fits within a single descriptor, causing the while (len != 0) loop to be skipped naturally, and the fragment loop in stmmacxmit() handles page fragments afterward.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31649?
CVE-2026-31649 is considered a moderate severity vulnerability due to the potential for integer underflow exploitation.
How do I fix CVE-2026-31649?
To fix CVE-2026-31649, update the Linux kernel to the latest stable version where the vulnerability is patched.
What types of systems are affected by CVE-2026-31649?
CVE-2026-31649 affects systems running the Linux kernel with the stmmac driver in chain mode.
What are the potential consequences of CVE-2026-31649?
Exploitation of CVE-2026-31649 may lead to system crashes or other unexpected behaviors due to the integer underflow.
Is CVE-2026-31649 actively being exploited in the wild?
As of now, there are no reported active exploits for CVE-2026-31649, but vigilance is recommended.