In the Linux kernel, the following vulnerability has been resolved:
scsi: libsas: Fix use-after-free bug in smpexecutetask_sg()
When executing SMP task failed, the smpexecutetasksg() calls deltimer() to delete "slowtask->timer". However, if the timer handler sastaskinternaltimedout() is running, the deltimer() in smpexecutetasksg() will not stop it and a UAF will happen. The process is shown below:
(thread 1) | (thread 2)
smpexecutetasksg() | sastaskinternaltimedout() ... | deltimer() | ... | ... sasfreetask(task) | kfree(task->slowtask) //FREE| | task->slow_task->... //USE
Fix by calling deltimersync() in smpexecutetasksg(), which makes sure the timer handler have finished before the "task->slowtask" is deallocated.
[
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"186346734633314153353763738193297759084",
"141327633564149950305551306113509126187",
"91272386166697800953521242895833488199",
"185122577366581753554829713247834856661"
]
},
"id": "CVE-2022-50422-4ddee16d",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a9e5176ead6de64f572ad5c87a72825d9d3c82ae",
"target": {
"file": "drivers/scsi/libsas/sas_expander.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"186346734633314153353763738193297759084",
"141327633564149950305551306113509126187",
"91272386166697800953521242895833488199",
"185122577366581753554829713247834856661"
]
},
"id": "CVE-2022-50422-f362fd44",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7a785177611ffc97d645fcbc196e6de6ad2421d",
"target": {
"file": "drivers/scsi/libsas/sas_expander.c"
}
}
]