CVE-2021-47012·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: RDMA/siw: Fix a use after free in siw_alloc_mr Our code analyzer reported a UAF. In siw_alloc_mr(), it calls siw_mr_add_mem(mr,..). In the implementation of siw_mr_add_mem(), mem is assigned to mr->mem and then mem is freed via kfree(mem) if xa_alloc_cyclic() failed. Here, mr->mem still point to a freed object. After, the execution continue up to the err_out branch of siw_alloc_mr, and the freed mr->mem is used in siw_mr_drop_mem(mr). My patch moves "mr->mem = mem" behind the if (xa_alloc_cyclic(..)<0) {} section, to avoid the uaf.
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.12.4
- Published
- 2024-02-28
Affected versions
From: 5.12
Until: 5.12.4
Fixed in: 5.12.4
How to fix this CVE
Update your Linux kernel to version 5.12.4 or later to resolve this use-after-free vulnerability in the RDMA siw driver. The vulnerability occurs when memory allocation fails during MR (Memory Region) initialization, leaving a dangling pointer that is subsequently dereferenced during error handling. Apply the patch immediately, particularly if your system uses RDMA over Sockets iWARP networking.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your kernel version with `uname -r` and compare against 5.12.4 as the minimum fixed version
- Step 2: Verify RDMA siw driver presence with `lsmod | grep siw` to determine if the vulnerable component is loaded
- Step 3: Search kernel logs for siw-related errors using `dmesg | grep -i siw` or `journalctl -k | grep siw` for UAF-related crashes
- Step 4: After patching, reboot and confirm new kernel version with `uname -r`, then verify siw module loads cleanly with `modprobe siw && lsmod | grep siw`
FAQ
What is CVE-2021-47012?
CVE-2021-47012 is a use-after-free vulnerability in the Linux kernel's RDMA siw (Sockets iWARP) driver. If memory allocation fails during MR initialization, a pointer is freed but remains referenced in the error handler, allowing potential code execution or denial of service.
Is CVE-2021-47012 being actively exploited?
No, CVE-2021-47012 is not listed in the CISA Known Exploited Vulnerabilities catalog and no public exploits are available. However, the high CVSS score (7.8) warrants prompt patching.
What versions of Kernel are affected by CVE-2021-47012?
Linux kernel versions 5.12 through 5.12.3 are vulnerable. The vulnerability is fixed in kernel 5.12.4 and later.
How do I check if my server is vulnerable to CVE-2021-47012?
Run `uname -r` to display your kernel version. If it reports 5.12.0 through 5.12.3, your system is vulnerable. Additionally check if siw driver is in use with `lsmod | grep siw`.
Does Defensia detect CVE-2021-47012?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2021-47012 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/3093ee182f01689b89e9f8797b321603e5de4f63
- https://git.kernel.org/stable/c/30b9e92d0b5e5d5dc1101ab856c17009537cbca4
- https://git.kernel.org/stable/c/3e22b88e02c194f6c80867abfef5cc09383461f4
- https://git.kernel.org/stable/c/608a4b90ece039940e9425ee2b39c8beff27e00c
- https://git.kernel.org/stable/c/ad9ce7188432650469a6c7625bf479f5ed0b6155
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47012. Free for 1 server.
Get started free