Vulnerability in Kernel: soc: bcm: Check for NULL return of devm_kzalloc()

Kernel Updated 02 Oct 2025

Summary

28/06/2022
N/A
No i
Unrated
Not published

GSD-2022-1003062: soc: bcm: Check for NULL return of devm_kzalloc(). Affects Kernel versions >= 8bcac4011ebe0dbdd46fd55b036ee855c95702d3, < 36339ea7bae4943be01c8e9545e46e334591fecd. No fix is published. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The Kernel is a crucial component of the Linux operating system, responsible for managing system resources and facilitating communication between hardware and software. It provides essential functionalities such as process management, memory management, and device drivers. The vulnerability in question affects the soc: bcm module within the Kernel. This module is responsible for handling Broadcom System-on-Chip (SoC) devices. Broadcom SoCs are widely used in various devices, including routers, switches, and IoT devices. The vulnerability arises from a failure to check for a NULL return value of the devm_kzalloc() function, which is used for memory allocation. This oversight can lead to potential security vulnerabilities and exploitation.

Vulnerability Detail

The vulnerability stems from the soc: bcm module's failure to properly handle the NULL return value of the devm_kzalloc() function. When devm_kzalloc() fails to allocate memory, it returns NULL. However, the code does not check for this NULL return value, assuming that memory allocation is always successful. This can result in subsequent code execution with a NULL pointer, leading to crashes, privilege escalation, or other security issues. Attackers may be able to exploit this vulnerability to execute arbitrary code or gain elevated privileges on affected systems. The vulnerability was introduced in version v5.12 of the Linux Kernel and has been fixed in version v5.17.14.

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 a patch or modify the code to include a check for the NULL return value of devm_kzalloc(). Here is an example of the modified code:

/* Original code */
ptr = devm_kzalloc(dev, size, GFP_KERNEL);

/* Modified code */
ptr = devm_kzalloc(dev, size, GFP_KERNEL);
if (!ptr) {
    /* Handle allocation failure */
    return -ENOMEM;
}

By adding the check and appropriate error handling, the vulnerability can be mitigated. However, it is recommended to apply the official fix by updating the Kernel to the latest version.

Conclusion

The vulnerability in the soc: bcm module of the Linux Kernel can potentially lead to security issues, including arbitrary code execution and privilege escalation. It is crucial to update the Kernel to version v5.17.14 or later to mitigate this vulnerability. Applying the official fix is recommended, although a workaround involving code modification is available. Regularly monitoring for vulnerabilities using tools like Vulert can help ensure the security of your software.

See every vulnerability recorded for Kernel →

Share this vulnerability

FAQ

The vulnerability can potentially allow attackers to execute arbitrary code or gain elevated privileges on affected systems. It may lead to system crashes, privilege escalation, or other security issues.

The vulnerability was introduced in version v5.12 of the Linux Kernel. All versions between v5.12 and v5.17.13 (inclusive) are affected.

There is no evidence of this vulnerability being exploited in the wild at the time of this report. However, it is crucial to apply the fix promptly to mitigate potential risks.

Yes, a workaround involves modifying the code to include a check for the NULL return value of devm_kzalloc(). However, it is recommended to apply the official fix by updating the Kernel to the latest version.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your system is affected by this vulnerability. Simply upload your package-lock.json file to the playground, and it will provide real-time monitoring and alerts for open-source vulnerabilities, including this one.

Related vulnerabilities

Recent vulnerabilities recorded for Kernel.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback