CVE-2021-47058 regmap: set debugfs_name to NULL after it is freed
A use-after-free vulnerability in the Linux kernel regmap debugfs handling allows attackers to potentially execute code or cause a denial of service.
- 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-47058?
CVE-2021-47058 is a high-severity use after free vulnerability in Linux kernel, published on 29 Feb 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:
regmap: set debugfs_name to NULL after it is freed
There is a upstream commit cffa4b2122f5("regmap:debugfs: Fix a memory leak when calling regmap_attach_dev") that adds a if condition when create name for debugfs_name. With below function invoking logical, debugfs_name is freed in regmap_debugfs_exit(), but it is not created again because of the if condition introduced by above commit. regmap_reinit_cache() regmap_debugfs_exit() ... regmap_debugfs_init() So, set debugfs_name to NULL after it is freed.
Weakness: CWE-416
Which versions are affected by CVE-2021-47058?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2021-47058?
Apply the vendor's patch.
Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.
Is CVE-2021-47058 being exploited?
There is no known exploitation of CVE-2021-47058 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as DEBIAN-CVE-2021-47058, GHSA-69w7-5x2m-p8cp, UBUNTU-CVE-2021-47058.