Skip to contentSkip to conversation

CVE-2025-37828: scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 8, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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.

The Linux kernel CVE team has assigned CVE-2025-37828 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.5 with commit f1304d4420777f82a1d844c606db3d9eca841765 and fixed in 6.6.89 with commit d6979fabe812a168d5053e5a41d5a2e9b8afd7bf
	Issue introduced in 6.5 with commit f1304d4420777f82a1d844c606db3d9eca841765 and fixed in 6.12.26 with commit 7d002f591486f5ef4bc02eb02025a53f931f0eb5
	Issue introduced in 6.5 with commit f1304d4420777f82a1d844c606db3d9eca841765 and fixed in 6.14.5 with commit 47eec518aef3814f64a5da43df81bdd74d8c0041
	Issue introduced in 6.5 with commit f1304d4420777f82a1d844c606db3d9eca841765 and fixed in 6.15-rc4 with commit 4c324085062919d4e21c69e5e78456dcec0052fe

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-37828

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/ufs/core/ufs-mcq.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/d6979fabe812a168d5053e5a41d5a2e9b8afd7bf
	https://git.kernel.org/stable/c/7d002f591486f5ef4bc02eb02025a53f931f0eb5
	https://git.kernel.org/stable/c/47eec518aef3814f64a5da43df81bdd74d8c0041
	https://git.kernel.org/stable/c/4c324085062919d4e21c69e5e78456dcec0052fe