Double-Free Vulnerability in regmap Package
Summary
GSD-2021-1001988: regmap: Fix possible double-free in regcache_rbtree_exit(). Affects Kernel versions >= 3f4ff561bc88b074d5e868dde4012d89cbb06c87, < 3dae1a4eced3ee733d7222e69b8a55caf2d61091. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The regmap package is a component of the Linux Kernel, which is responsible for managing register maps for various hardware devices. It provides an abstraction layer for accessing and manipulating device registers. The regcache_rbtree_exit() function within the regmap package is susceptible to a double-free vulnerability.
Vulnerability Detail
The double-free vulnerability in regcache_rbtree_exit() can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code. This vulnerability occurs when the function attempts to free a memory region that has already been freed, leading to memory corruption and potential system instability. The impact and attack plausibility of this vulnerability have not been proven yet.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a workaround, users can apply the patch manually to the affected version of the Linux Kernel. Here is an example of the patch:
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -123,6 +123,7 @@ void regcache_rbtree_exit(struct regmap *map)
struct regcache_rbtree *tree = map->cache_priv;
struct rb_node *node;
struct rb_node *next;
+
mutex_lock(&map->mutex);
for (node = rb_first(&tree->root); node; node = next) {
Conclusion
The double-free vulnerability in regcache_rbtree_exit() poses a potential security risk in the Linux Kernel. It is recommended to update the kernel to version v4.19.215 or later to mitigate this vulnerability. Applying the provided patch or using Vulert's playground can also help identify and address the vulnerability. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
Regmap is a component of the Linux Kernel that manages register maps for hardware devices. It provides an abstraction layer for accessing and manipulating device registers, making it easier for drivers to interact with hardware.
A double-free vulnerability occurs when a program attempts to free a memory region that has already been freed. This can lead to memory corruption and potentially allow an attacker to execute arbitrary code or cause a denial-of-service condition.
The double-free vulnerability in regcache_rbtree_exit() could result in a denial-of-service condition, where the system becomes unresponsive or crashes. In some cases, it may also be possible for an attacker to exploit this vulnerability to execute arbitrary code, potentially compromising the security of the system.
You can use Vulert's playground at Vulert Scanner to check if your system is affected by this vulnerability. Vulert uses a manifest file like package-lock.json to monitor and alert in real-time for open-source vulnerabilities in software, without requiring access to the code or installation.
You can find more information about this vulnerability in the GSD-2021-1001988 entry on the Cloud Security Alliance's GSD database. The entry provides details about the vulnerability, including its impact, affected versions, and references to the relevant commits in the Linux Kernel repository.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.