Vulnerability in Kernel: soc: bcm: Check for NULL return of devm_kzalloc()
Summary
GSD-2022-1002719: soc: bcm: Check for NULL return of devm_kzalloc(). Affects Kernel versions >= 8bcac4011ebe0dbdd46fd55b036ee855c95702d3, < b48b98743b568bb219152ba2e15af6ef0d3d8a9b. 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 acts as an interface between hardware and software. It is responsible for managing system resources, handling device drivers, and facilitating communication between different software components. The soc: bcm module within the Kernel is specifically related to Broadcom System-on-Chip (SoC) devices. These devices are commonly used in various electronic devices, including routers, switches, and IoT devices. The soc: bcm module provides support for the functionality and drivers required for these Broadcom SoC devices to operate effectively within the Linux environment.
Vulnerability Detail
The vulnerability identified in the soc: bcm module is related to the improper handling of memory allocation. Specifically, the code does not check for a NULL return value when using the devm_kzalloc() function. This function is responsible for allocating memory with automatic cleanup upon device removal. If the devm_kzalloc() function fails to allocate memory and returns NULL, subsequent operations relying on this memory allocation can lead to unexpected behavior, including crashes, data corruption, or potential security vulnerabilities. The impact and attack plausibility of this vulnerability have not been proven yet, but it is essential to address it to ensure the stability and security of systems utilizing Broadcom SoC devices.
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 this vulnerability is addressed in the latest Kernel version, the recommended approach is to update the Kernel. However, if immediate Kernel update is not feasible, a temporary workaround can be implemented by modifying the code to manually check for the NULL return of devm_kzalloc() and handle it appropriately. Here is an example of how this can be done:
/* Original code */
ptr = devm_kzalloc(dev, size, GFP_KERNEL);
/* Workaround code */
ptr = devm_kzalloc(dev, size, GFP_KERNEL);
if (!ptr) {
/* Handle NULL return appropriately */
}
It is important to note that workarounds may introduce additional complexities and should only be considered as temporary measures until the Kernel can be updated.
Conclusion
The vulnerability in the soc: bcm module of the Kernel, related to the improper handling of memory allocation, can lead to unexpected behavior, crashes, data corruption, or potential security vulnerabilities. It is crucial to update the Kernel to version v5.18.3 or later to address this vulnerability. In the meantime, a temporary workaround can be implemented by manually checking for the NULL return of devm_kzalloc() and handling it appropriately. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The Kernel is a critical component of the Linux operating system that provides core functionalities and acts as an interface between hardware and software.
The soc: bcm module within the Kernel is specifically related to Broadcom System-on-Chip (SoC) devices. These devices are commonly used in various electronic devices, including routers, switches, and IoT devices.
devm_kzalloc() is a function in the Linux Kernel that is responsible for allocating memory with automatic cleanup upon device removal.
The potential risks of this vulnerability include crashes, data corruption, or potential security vulnerabilities due to unexpected behavior resulting from improper memory allocation.
To fix this vulnerability, it is necessary to update the Linux Kernel to version v5.18.3 or later, which includes the fix for this issue.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.