Skip to contentSkip to conversation

CVE-2025-38142: hwmon: (asus-ec-sensors) check sensor index in read_string()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 3, 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:

hwmon: (asus-ec-sensors) check sensor index in read_string()

Prevent a potential invalid memory access when the requested sensor is not found.

find_ec_sensor_index() may return a negative value (e.g. -ENOENT), but its result was used without checking, which could lead to undefined behavior when passed to get_sensor_info().

Add a proper check to return -EINVAL if sensor_index is negative.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

[groeck: Return error code returned from find_ec_sensor_index]

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

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

	Issue introduced in 5.18 with commit d0ddfd241e5719d696bc0b081e260db69d368668 and fixed in 6.1.142 with commit 6bf529ce84dccc0074dbc704e70aee4aa545057e
	Issue introduced in 5.18 with commit d0ddfd241e5719d696bc0b081e260db69d368668 and fixed in 6.6.94 with commit 4e9e45746b861ebd54c03ef301da2cb8fc990536
	Issue introduced in 5.18 with commit d0ddfd241e5719d696bc0b081e260db69d368668 and fixed in 6.12.34 with commit 19bd9cde38dd4ca1771aed7afba623e7f4247c8e
	Issue introduced in 5.18 with commit d0ddfd241e5719d696bc0b081e260db69d368668 and fixed in 6.15.3 with commit 7eeb3df6f07a886bdfd52757ede127a59a8784dc
	Issue introduced in 5.18 with commit d0ddfd241e5719d696bc0b081e260db69d368668 and fixed in 6.16-rc1 with commit 25be318324563c63cbd9cb53186203a08d2f83a1

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

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/asus-ec-sensors.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/6bf529ce84dccc0074dbc704e70aee4aa545057e
	https://git.kernel.org/stable/c/4e9e45746b861ebd54c03ef301da2cb8fc990536
	https://git.kernel.org/stable/c/19bd9cde38dd4ca1771aed7afba623e7f4247c8e
	https://git.kernel.org/stable/c/7eeb3df6f07a886bdfd52757ede127a59a8784dc
	https://git.kernel.org/stable/c/25be318324563c63cbd9cb53186203a08d2f83a1