Skip to contentSkip to conversation

CVE-2025-21656: hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jan 21, 2025

lore
Share & tools
lore
#0 lore raw

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

In the Linux kernel, the following vulnerability has been resolved:

hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur

scsi_execute_cmd() function can return both negative (linux codes) and positive (scsi_cmnd result field) error codes.

Currently the driver just passes error codes of scsi_execute_cmd() to hwmon core, which is incorrect because hwmon only checks for negative error codes. This leads to hwmon reporting uninitialized data to userspace in case of SCSI errors (for example if the disk drive was disconnected).

This patch checks scsi_execute_cmd() output and returns -EIO if it's error code is positive.

[groeck: Avoid inline variable declaration for portability]

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

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

	Issue introduced in 5.6 with commit 5b46903d8bf372e563bf2150d46b87fff197a109 and fixed in 6.6.72 with commit 53e25b10a28edaf8c2a1d3916fd8929501a50dfc
	Issue introduced in 5.6 with commit 5b46903d8bf372e563bf2150d46b87fff197a109 and fixed in 6.12.10 with commit 42268d885e44af875a6474f7bba519cc6cea6a9d
	Issue introduced in 5.6 with commit 5b46903d8bf372e563bf2150d46b87fff197a109 and fixed in 6.13 with commit 82163d63ae7a4c36142cd252388737205bb7e4b9

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-21656

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/hwmon/drivetemp.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/53e25b10a28edaf8c2a1d3916fd8929501a50dfc
	https://git.kernel.org/stable/c/42268d885e44af875a6474f7bba519cc6cea6a9d
	https://git.kernel.org/stable/c/82163d63ae7a4c36142cd252388737205bb7e4b9