Memory Leak Vulnerability in ptp_clock_register() in Kernel
Summary
GSD-2021-1002167: ptp: Fix possible memory leak in ptp_clock_register(). Affects Kernel versions >= a33121e5487b424339636b25c35d3a180eaa5f5e, < 4225fea1cb28370086e17e82c0f69bec2779dca0. 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 critical component of the Linux operating system that provides core functionalities and interfaces with hardware devices. It manages system resources, facilitates communication between software and hardware, and ensures the stability and security of the system. One of the features provided by the Kernel is the Precision Time Protocol (PTP), which enables accurate time synchronization between devices. The ptp_clock_register() function is responsible for registering a PTP clock with the Kernel. However, a vulnerability has been identified in this function that can lead to a memory leak.
Vulnerability Detail
The vulnerability in ptp_clock_register() allows for a possible memory leak. When registering a PTP clock, if an error occurs during the process, the function fails to release the allocated memory, resulting in a memory leak. This can lead to a gradual depletion of available memory resources, potentially causing system instability or denial of service. The vulnerability was introduced in version v5.5 of the Linux Kernel and has been fixed in version v5.15.
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, developers can manually release the allocated memory in case of errors during the registration of a PTP clock. Here is an example of how to handle the error and release the memory:
int ret = ptp_clock_register(clock);
if (ret < 0) {
kfree(clock);
return ret;
}
Conclusion
The memory leak vulnerability in ptp_clock_register() in the Kernel can lead to a gradual depletion of available memory resources, potentially causing system instability or denial of service. It is crucial to update the Linux Kernel to version v5.15 or later to fix this vulnerability. Alternatively, developers can apply the provided workaround to manually release the allocated memory in case of errors during the registration of a PTP clock. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability can result in a memory leak, gradually depleting available memory resources. This can lead to system instability or denial of service.
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 any open-source vulnerabilities, including this memory leak vulnerability in ptp_clock_register().
Yes, the vulnerability has been fixed in version v5.15 of the Linux Kernel. It is recommended to update your Kernel to this version or later to mitigate the risk of memory leaks.
Yes, as a workaround, you can manually release the allocated memory in case of errors during the registration of a PTP clock. Refer to the 'workaround' section for an example of how to handle the error and release the memory.
You can find more information about this vulnerability, including the fix and its impact, in the vulnerability report at https://github.com/cloudsecurityalliance/gsd-database/blob/main/2021/1002xxx/GSD-2021-1002167.json.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.