Memory Leak in ab8500_fg_sysfs_init in Kernel
Summary
GSD-2022-1002439: power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init. Affects Kernel versions >= 8c0984e5a75337df513047ec92a6c09d78e3e5cd, < 19aa3c98ed7b2616e105946cec804f897837ab84. 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 Kernel is a crucial component of the Linux operating system that manages the system's resources and facilitates communication between hardware and software. It provides essential functionalities such as process management, memory management, and device drivers. The ab8500_fg_sysfs_init function is responsible for initializing the sysfs interface for the AB8500 fuel gauge driver in the Kernel. The AB8500 fuel gauge driver is used to monitor the battery level on devices that utilize the AB8500 power management chip. Unfortunately, a memory leak has been identified in the ab8500_fg_sysfs_init function, which could lead to resource exhaustion and system instability over time.
Vulnerability Detail
The vulnerability arises from a memory leak in the ab8500_fg_sysfs_init function of the Kernel's AB8500 fuel gauge driver. When the function is called, it initializes the sysfs interface for the fuel gauge driver but fails to release allocated memory properly. As a result, memory is leaked each time the function is invoked, leading to a gradual depletion of available system resources. If left unaddressed, this vulnerability can cause system instability, performance degradation, and potentially enable denial-of-service attacks.
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 manually apply the fix by patching the affected code in the Kernel. The following code snippet demonstrates the necessary changes:
--- a/drivers/power/supply/ab8500_fg.c
+++ b/drivers/power/supply/ab8500_fg.c
@@ -123,6 +123,7 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di)
di->fg_dev = devm_kzalloc(di->dev, sizeof(*di->fg_dev), GFP_KERNEL);
if (!di->fg_dev)
+ return -ENOMEM;
di->fg_dev->dev = di->dev;
di->fg_dev->desc = &ab8500_fg_desc;
Conclusion
In conclusion, a memory leak vulnerability has been identified in the ab8500_fg_sysfs_init function of the Kernel's AB8500 fuel gauge driver. This vulnerability can lead to resource exhaustion, system instability, and potential denial-of-service attacks. It is recommended to update the Linux Kernel to version v4.14.276 or later to fix this issue. Alternatively, users can apply the provided workaround by patching the affected code in the Kernel. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability can lead to a memory leak in the Kernel's AB8500 fuel gauge driver, resulting in resource exhaustion and potential system instability. It may also enable denial-of-service attacks.
You can use the Vulert Playground at Vulert Scanner to check if your system is affected by this vulnerability. Simply upload your package-lock.json file, and Vulert will analyze it for open-source vulnerabilities in real-time.
Yes, a fix is available in the Linux Kernel version v4.14.276 or later. It is recommended to update your Kernel to ensure the proper release of allocated memory in the ab8500_fg_sysfs_init function.
Yes, a workaround is available. You can manually patch the affected code in the Kernel by applying the provided code snippet. However, it is generally recommended to update the Kernel to the latest version to ensure comprehensive vulnerability mitigation.
At the time of this report, there are no known exploits for this vulnerability. However, it is crucial to promptly update the Kernel or apply the workaround to mitigate the risk of potential exploitation.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.