漏洞标题
scsi: ufs: mcq: 在ufshcd_mcq_abort()中添加对NULL的检查
漏洞描述信息
## 漏洞概述
在Linux内核的UFS(Universal Flash Storage)子系统中,发现了一个可能的空指针解引用漏洞。具体的漏洞位于`ufshcd_mcq_abort()`函数中,由于MCQ完成路径和中止处理程序之间的竞争条件,可能导致内核崩溃。
## 影响版本
未提供具体版本信息。
## 漏洞细节
在UFS子系统中,MCQ(Multi-Command Queue)完成路径与中止处理程序之间存在竞争条件。一旦请求完成, `__blk_mq_free_request()`将`rq->mq_hctx`设置为NULL,从而使`ufshcd_mcq_abort()`中的`ufshcd_mcq_req_to_hwq()`调用返回一个NULL指针。如果这个NULL指针被解引用,内核将崩溃。
## 影响
修复方案中增加了对返回的`hwq`指针的NULL检查。如果`hwq`为NULL,则记录错误并返回FAILED,防止潜在的空指针解引用。这种修复方法类似于commit 74736103fb41中的修复方式。
此漏洞是通过静态分析工具KNighter发现的。
CVSS信息
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
漏洞类别
空指针解引用
漏洞标题
scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort()
漏洞描述信息
In the Linux kernel, the following vulnerability has been resolved:
scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort()
A race can occur between the MCQ completion path and the abort handler:
once a request completes, __blk_mq_free_request() sets rq->mq_hctx to
NULL, meaning the subsequent ufshcd_mcq_req_to_hwq() call in
ufshcd_mcq_abort() can return a NULL pointer. If this NULL pointer is
dereferenced, the kernel will crash.
Add a NULL check for the returned hwq pointer. If hwq is NULL, log an
error and return FAILED, preventing a potential NULL-pointer
dereference. As suggested by Bart, the ufshcd_cmd_inflight() check is
removed.
This is similar to the fix in commit 74736103fb41 ("scsi: ufs: core: Fix
ufshcd_abort_one racing issue").
This is found by our static analysis tool KNighter.
CVSS信息
N/A
漏洞类别
N/A