CVE-2025-38217 hwmon: (ftsteutates) Fix TOCTOU race in fts_read()
A race condition in the Linux kernel hwmon driver allows a local attacker to trigger a crash or undefined behavior via concurrent access to fan source data.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-38217?
CVE-2025-38217 is a medium-severity vulnerability in Linux kernel, published on 4 Jul 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
hwmon: (ftsteutates) Fix TOCTOU race in fts_read()
In the fts_read() function, when handling hwmon_pwm_auto_channels_temp, the code accesses the shared variable data->fan_source[channel] twice without holding any locks. It is first checked against FTS_FAN_SOURCE_INVALID, and if the check passes, it is read again when used as an argument to the BIT() macro.
This creates a Time-of-Check to Time-of-Use (TOCTOU) race condition. Another thread executing fts_update_device() can modify the value of data->fan_source[channel] between the check and its use. If the value is changed to FTS_FAN_SOURCE_INVALID (0xff) during this window, the BIT() macro will be called with a large shift value (BIT(255)). A bit shift by a value greater than or equal to the type width is undefined behavior and can lead to a crash or incorrect values being returned to userspace.
Fix this by reading data->fan_source[channel] into a local variable once, eliminating the race condition. Additionally, add a bounds check to ensure the value is less than BITS_PER_LONG before passing it to the BIT() macro, making the code more robust against undefined behavior.
This possible bug was found by an experimental static analysis tool developed by our team.
Weakness: CWE-367
Which versions are affected by CVE-2025-38217?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2025-38217?
Apply the vendor's patch.
Is CVE-2025-38217 being exploited?
There is no known exploitation of CVE-2025-38217 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as AZL-64707, BELL-CVE-2025-38217, DEBIAN-CVE-2025-38217, GHSA-gcgx-pvvc-73xm, ROOT-OS-UBUNTU-2404-CVE-2025-38217, UBUNTU-CVE-2025-38217.