In the Linux kernel, the following vulnerability has been resolved:
RDMA/siw: Fix a use after free in siwallocmr
Our code analyzer reported a UAF.
In siwallocmr(), it calls siwmraddmem(mr,..). In the implementation of siwmraddmem(), mem is assigned to mr->mem and then mem is freed via kfree(mem) if xaalloccyclic() failed. Here, mr->mem still point to a freed object. After, the execution continue up to the errout branch of siwallocmr, and the freed mr->mem is used in siwmrdropmem(mr).
My patch moves "mr->mem = mem" behind the if (xaalloccyclic(..)<0) {} section, to avoid the uaf.
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47012.json"
[
{
"events": [
{
"introduced": "5.3"
},
{
"fixed": "5.4.119"
}
]
},
{
"events": [
{
"introduced": "5.5"
},
{
"fixed": "5.10.37"
}
]
},
{
"events": [
{
"introduced": "5.11"
},
{
"fixed": "5.11.21"
}
]
},
{
"events": [
{
"introduced": "5.12"
},
{
"fixed": "5.12.4"
}
]
}
]