CVE-2021-47586 net: stmmac: dwmac-rk: fix oob read in rk_gmac_setup
An out-of-bounds read in the Linux kernel's stmmac driver can lead to information disclosure or system crashes.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-47586?
CVE-2021-47586 is a medium-severity memory corruption vulnerability in Linux kernel, published on 19 Jun 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
net: stmmac: dwmac-rk: fix oob read in rk_gmac_setup
KASAN reports an out-of-bounds read in rk_gmac_setup on the line:
while (ops->regs[i]) {
This happens for most platforms since the regs flexible array member is empty, so the memory after the ops structure is being read here. It seems that mostly this happens to contain zero anyway, so we get lucky and everything still works.
To avoid adding redundant data to nearly all the ops structures, add a new flag to indicate whether the regs field is valid and avoid this loop when it is not.
Weakness: CWE-125
Which versions are affected by CVE-2021-47586?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2021-47586?
Apply the vendor's patch.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2021-47586 being exploited?
There is no known exploitation of CVE-2021-47586 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as DEBIAN-CVE-2021-47586, GHSA-89r8-fpgw-f2hq, UBUNTU-CVE-2021-47586.