CVE-2021-47231·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: can: mcba_usb: fix memory leak in mcba_usb Syzbot reported memory leak in SocketCAN driver for Microchip CAN BUS Analyzer Tool. The problem was in unfreed usb_coherent. In mcba_usb_start() 20 coherent buffers are allocated and there is nothing, that frees them: 1) In callback function the urb is resubmitted and that's all 2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER is not set (see mcba_usb_start) and this flag cannot be used with coherent buffers. Fail log: | [ 1354.053291][ T8413] mcba_usb 1-1:0.0 can0: device disconnected | [ 1367.059384][ T8420] kmemleak: 20 new suspected memory leaks (see /sys/kernel/debug/kmem) So, all allocated buffers should be freed with usb_free_coherent() explicitly NOTE: The same pattern for allocating and freeing coherent buffers is used in drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
- Severity
- medium
- Software
- Kernel
- Fixed in
- 5.12.13
- Published
- 2024-05-21
Affected versions
From: 5.11
Until: 5.12.13
Fixed in: 5.12.13
How to fix this CVE
Update your Linux kernel to version 5.12.13 or later to resolve a memory leak in the mcba_usb SocketCAN driver for Microchip CAN BUS Analyzer devices. The vulnerability causes USB coherent buffers to remain allocated after device disconnection, gradually consuming system memory. Kernel upgrades should be tested in a staging environment before production deployment.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Run 'uname -r' to check the current kernel version and confirm if it falls within the vulnerable range (5.11.x to 5.12.12)
- Execute 'lsmod | grep mcba_usb' to determine if the Microchip CAN BUS Analyzer driver is loaded on the system
- Search kernel logs with 'dmesg | grep -i mcba_usb' or 'journalctl -u kernel | grep mcba_usb' for any device disconnect events or memory-related warnings
- Verify the patch has been applied by confirming kernel version is 5.12.13 or later using 'uname -r', then check /sys/kernel/debug/kmemleak for any persistent memory leak reports related to mcba_usb
FAQ
What is CVE-2021-47231?
CVE-2021-47231 is a memory leak vulnerability in the Linux kernel's mcba_usb SocketCAN driver. When a Microchip CAN BUS Analyzer device is disconnected, allocated USB coherent buffers are not properly freed, causing persistent memory loss that accumulates with repeated device connections and disconnections.
Is CVE-2021-47231 being actively exploited?
No, CVE-2021-47231 is not listed in CISA's Known Exploited Vulnerabilities catalog and has no public exploit availability. However, it can still cause denial of service through memory exhaustion on systems with repeated device connect/disconnect cycles.
What versions of Kernel are affected by CVE-2021-47231?
Linux kernel versions 5.11.0 through 5.12.12 are vulnerable. The fix was released in kernel version 5.12.13 and later stable branches.
How do I check if my server is vulnerable to CVE-2021-47231?
Run 'uname -r' to check your kernel version; if it shows 5.11.x or 5.12.x (up to 5.12.12), your system is vulnerable. Additionally, check if mcba_usb is in use with 'lsmod | grep mcba_usb' to determine exposure.
Does Defensia detect CVE-2021-47231?
Yes — Defensia's CVE advisory scanner compares installed kernel package versions against the NVD database. If a vulnerable kernel version is detected on a monitored server, CVE-2021-47231 will appear in your dashboard with remediation steps and patch availability.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/6bd3d80d1f019cefa7011056c54b323f1d8b8e83
- https://git.kernel.org/stable/c/6f87c0e21ad20dd3d22108e33db1c552dfa352a0
- https://git.kernel.org/stable/c/89df95ce32be204eef2e7d4b2f6fb552fb191a68
- https://git.kernel.org/stable/c/91c02557174be7f72e46ed7311e3bea1939840b0
- https://git.kernel.org/stable/c/a115198caaab6d663bef75823a3c5f0802306d60
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47231. Free for 1 server.
Get started free