CVE-2025-21804 PCI: rcar-ep: Fix incorrect variable used when calling devm_request_mem_region()
A bug in the Linux kernel PCI driver can cause a system crash due to undefined behavior when handling memory region names.
- 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-2025-21804?
CVE-2025-21804 is a high-severity vulnerability in Linux kernel, published on 27 Feb 2025. 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:
PCI: rcar-ep: Fix incorrect variable used when calling devm_request_mem_region()
The rcar_pcie_parse_outbound_ranges() uses the devm_request_mem_region() macro to request a needed resource. A string variable that lives on the stack is then used to store a dynamically computed resource name, which is then passed on as one of the macro arguments. This can lead to undefined behavior.
Depending on the current contents of the memory, the manifestations of errors may vary. One possible output may be as follows:
$ cat /proc/iomem 30000000-37ffffff : 38000000-3fffffff :
Sometimes, garbage may appear after the colon.
In very rare cases, if no NULL-terminator is found in memory, the system might crash because the string iterator will overrun which can lead to access of unmapped memory above the stack.
Thus, fix this by replacing outbound_name with the name of the previously requested resource. With the changes applied, the output will be as follows:
$ cat /proc/iomem 30000000-37ffffff : memory2 38000000-3fffffff : memory3
[kwilczynski: commit log]
Weakness: CWE-476
Which versions are affected by CVE-2025-21804?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2025-21804?
Apply the vendor's patch.
Is CVE-2025-21804 being exploited?
There is no known exploitation of CVE-2025-21804 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as BELL-CVE-2025-21804, DEBIAN-CVE-2025-21804, GHSA-8w2r-337g-j83r, ROOT-OS-UBUNTU-2404-CVE-2025-21804, UBUNTU-CVE-2025-21804.