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.