{"id":"CVE-2025-38217","published":"2025-07-04T13:37:34Z","modified":"2026-05-11T21:23:30Z","title":"hwmon: (ftsteutates) Fix TOCTOU race in fts_read()","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nhwmon: (ftsteutates) Fix TOCTOU race in fts_read()\n\nIn the fts_read() function, when handling hwmon_pwm_auto_channels_temp,\nthe code accesses the shared variable data->fan_source[channel] twice\nwithout holding any locks. It is first checked against\nFTS_FAN_SOURCE_INVALID, and if the check passes, it is read again\nwhen used as an argument to the BIT() macro.\n\nThis creates a Time-of-Check to Time-of-Use (TOCTOU) race condition.\nAnother thread executing fts_update_device() can modify the value of\ndata->fan_source[channel] between the check and its use. If the value\nis changed to FTS_FAN_SOURCE_INVALID (0xff) during this window, the\nBIT() macro will be called with a large shift value (BIT(255)).\nA bit shift by a value greater than or equal to the type width is\nundefined behavior and can lead to a crash or incorrect values being\nreturned to userspace.\n\nFix this by reading data->fan_source[channel] into a local variable\nonce, eliminating the race condition. Additionally, add a bounds check\nto ensure the value is less than BITS_PER_LONG before passing it to\nthe BIT() macro, making the code more robust against undefined behavior.\n\nThis possible bug was found by an experimental static analysis tool\ndeveloped by our team.","provenance":"source","from":"CVE.org"},"cvss":null,"epss":{"score":0.00125,"percentile":0.02235,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/d95d87841d2a575bed3691884e8fedef57d7710d","tags":[]},{"url":"https://git.kernel.org/stable/c/83e2ba8971ccd8fc08319fc7593288f070d80a76","tags":[]},{"url":"https://git.kernel.org/stable/c/4d646f627d3b7ed1cacca66e598af8bcd632d465","tags":[]},{"url":"https://git.kernel.org/stable/c/14c9ede9ca4cd078ad76a6ab9617b81074eb58bf","tags":[]}],"priority":{"score":0.4,"factors":[{"name":"EPSS percentile","points":0.45}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= 1c5759d8ce054961b454af69568a41e7e3210ee1, < d95d87841d2a575bed3691884e8fedef57d7710d",">= 1c5759d8ce054961b454af69568a41e7e3210ee1, < 83e2ba8971ccd8fc08319fc7593288f070d80a76",">= 1c5759d8ce054961b454af69568a41e7e3210ee1, < 4d646f627d3b7ed1cacca66e598af8bcd632d465",">= 1c5759d8ce054961b454af69568a41e7e3210ee1, < 14c9ede9ca4cd078ad76a6ab9617b81074eb58bf"]},{"vendor":"Linux","product":"Linux","versions":["6.3"]}],"euvd":{"id":"EUVD-2025-20039","exploited":false,"provenance":"source"}}