CVE-2021-47012
JSON

7.8high

RDMA/siw: Fix a use after free in siw_alloc_mr

Severity
7.8high CVSS:3.1 by Linux
Exploit likelihood
0.27% (higher than 20% of CVEs; EPSS, by FIRST)
Published
Last changed
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.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 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 *
CVE List
linux linux_kernelfrom 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.4NVD

All scores

Linux7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-416

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

NVD (es)

En el kernel de Linux se ha resuelto la siguiente vulnerabilidad: RDMA/siw: Corrige un use after free en siw_alloc_mr Nuestro analizador de código informó un UAF. En siw_alloc_mr(), llama a siw_mr_add_mem(mr,..). En la implementación de siw_mr_add_mem(), mem se asigna a mr-&gt;mem y luego mem se libera mediante kfree(mem) si xa_alloc_ciclic() falla. Aquí, mr-&gt;mem todavía apunta a un objeto liberado. Después, la ejecución continúa hasta la rama err_out de siw_alloc_mr, y el mr-&gt;mem liberado se usa en siw_mr_drop_mem(mr). Mi parche mueve "mr-&gt;mem = mem" detrás de la sección if (xa_alloc_ciclic(..)&lt;0) {}, para evitar el uaf.

References

Sources

SourceRecordLicence
CVE ListCVE-2021-47012 changed 2026-08-05CVE Terms of Use
NVDCVE-2021-47012 changed 2026-08-04Public domain