# CVE-2021-47012: RDMA/siw: Fix a use after free in siw_alloc_mr

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 20% of CVEs (2026-12-01)
- Published: 2024-02-28T08:13:30.284Z
- Modified: 2026-08-05T08:45:33.281Z
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

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.

(As written by CVE List.)

## Affected

- Linux Linux: from 2251334dcac9eb337575d8767e2a6a7e81848f7f before 30b9e92d0b5e5d5dc1101ab856c17009537cbca4; from 2251334dcac9eb337575d8767e2a6a7e81848f7f before 608a4b90ece039940e9425ee2b39c8beff27e00c; from 2251334dcac9eb337575d8767e2a6a7e81848f7f before 3e22b88e02c194f6c80867abfef5cc09383461f4; from 2251334dcac9eb337575d8767e2a6a7e81848f7f before ad9ce7188432650469a6c7625bf479f5ed0b6155; from 2251334dcac9eb337575d8767e2a6a7e81848f7f before 3093ee182f01689b89e9f8797b321603e5de4f63; 5.3 (not affected: before 5.3; from 5.4.119 up to 5.4.*; from 5.10.37 up to 5.10.*; from 5.11.21 up to 5.11.*; from 5.12.4 up to 5.12.*; from 5.13 up to *)
- linux linux_kernel: from 5.3 before 5.4.119; from 5.5 before 5.10.37; from 5.11 before 5.11.21; from 5.12 before 5.12.4

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/30b9e92d0b5e5d5dc1101ab856c17009537cbca4> (patch)
- <https://git.kernel.org/stable/c/608a4b90ece039940e9425ee2b39c8beff27e00c> (patch)
- <https://git.kernel.org/stable/c/3e22b88e02c194f6c80867abfef5cc09383461f4> (patch)
- <https://git.kernel.org/stable/c/ad9ce7188432650469a6c7625bf479f5ed0b6155> (patch)
- <https://git.kernel.org/stable/c/3093ee182f01689b89e9f8797b321603e5de4f63> (patch)

## Sources

- CVE List: [CVE-2021-47012](https://www.cve.org/CVERecord?id=CVE-2021-47012), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2021-47012](https://nvd.nist.gov/vuln/detail/CVE-2021-47012), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2021-47012 · Whole record: https://cve.day/CVE-2021-47012.json · Rebuilt by cve.day 2026-11-25T22:58:08.616Z
