Security Vulnerability Report
中文
CVE-2022-50537 CVSS 5.5 MEDIUM

CVE-2022-50537

Published: 2025-10-07 16:15:38
Last Modified: 2026-02-26 23:16:38
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Description

In the Linux kernel, the following vulnerability has been resolved: firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe() In rpi_firmware_probe(), if mbox_request_channel() fails, the 'fw' will not be freed through rpi_firmware_delete(), fix this leak by calling kfree() in the error path.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
Linux kernel < 6.0(受影响的稳定分支)
Linux kernel 5.15.x(受影响)
Linux kernel 5.10.x(受影响)
Linux kernel 5.4.x(受影响)
Linux kernel 4.19.x(受影响)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
/* CVE-2022-50537 PoC - Memory Leak in rpi_firmware_probe() * This PoC demonstrates how to trigger the memory leak by repeatedly * forcing mbox_request_channel() to fail during probe. * * Note: This requires kernel module compilation and root privileges. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/slab.h> static int trigger_probe_failure_count = 0; /* Simulate the vulnerable code path */ static void simulate_vulnerable_probe(void) { struct rpi_firmware *fw; int ret; /* Step 1: Allocate firmware structure (similar to kzalloc in real driver) */ fw = kzalloc(sizeof(struct rpi_firmware), GFP_KERNEL); if (!fw) return; /* Step 2: Simulate mbox_request_channel() failure */ /* In real scenario, this fails when mailbox subsystem is unavailable */ ret = -ENODEV; /* Simulated failure */ if (ret) { /* BUG: 'fw' is not freed here - memory leak! */ /* Fix should add: kfree(fw); before returning */ trigger_probe_failure_count++; printk(KERN_ERR "rpi_firmware: mbox_request_channel failed, " "leaking %zu bytes (leak count: %d)\n", sizeof(struct rpi_firmware), trigger_probe_failure_count); return; /* Memory leak occurs here */ } /* Normal cleanup - only reached on success */ kfree(fw); } static int __init poc_init(void) { int i; printk(KERN_INFO "CVE-2022-50537 PoC loaded\n"); /* Trigger the leak multiple times to demonstrate accumulation */ for (i = 0; i < 1000; i++) { simulate_vulnerable_probe(); } printk(KERN_INFO "PoC: Triggered %d memory leaks\n", trigger_probe_failure_count); return 0; } static void __exit poc_exit(void) { printk(KERN_INFO "CVE-2022-50537 PoC unloaded\n"); } module_init(poc_init); module_exit(poc_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("PoC for CVE-2022-50537 rpi_firmware memory leak"); /* Fixed version would include kfree(fw) in the error path: * * if (ret) { * kfree(fw); * return ret; * } */

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2022-50537", "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "published": "2025-10-07T16:15:37.943", "lastModified": "2026-02-26T23:16:38.403", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nfirmware: raspberrypi: fix possible memory leak in rpi_firmware_probe()\n\nIn rpi_firmware_probe(), if mbox_request_channel() fails, the 'fw' will\nnot be freed through rpi_firmware_delete(), fix this leak by calling\nkfree() in the error path."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-401"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.10.65", "versionEndExcluding": "5.10.163", "matchCriteriaId": "F188E0D7-1C36-45D7-9412-05278A1BC923"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.13", "versionEndExcluding": "5.15.86", "matchCriteriaId": "7520696A-9404-4EF7-BE25-AE79EAFA5337"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.16", "versionEndExcluding": "6.0.16", "matchCriteriaId": "C720A569-3D93-4D77-95F6-E2B3A3267D9F"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.1", "versionEndExcluding": "6.1.2", "matchCriteriaId": "77239F4B-6BB2-4B9E-A654-36A52396116C"}]}]}], "references": [{"url": "https://git.kernel.org/stable/c/62ac943eb2a9d655e431b9bc98ff6d7bd51a0e49", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/6757dd2193fe18c5c5fe3050e7f2ff9dcbd1ff34", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/71d2abab374f707ab8ac8dcef191fd2b3b67b8bd", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/7b51161696e803fd5f9ad55b20a64c2df313f95c", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/b308fdedef095aac14569f810d46edf773ea7d1e", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/d34742245e4366579f9a80f8cfe4a63248e838e0", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}]}}