{"id":"CVE-2025-38217","state":"PUBLISHED","title":"hwmon: (ftsteutates) Fix TOCTOU race in fts_read()","description":"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.","publishedAt":"2025-07-04T13:37:34.532Z","updatedAt":"2026-05-11T21:23:30.209Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"d95d87841d2a575bed3691884e8fedef57d7710d","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"83e2ba8971ccd8fc08319fc7593288f070d80a76","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"4d646f627d3b7ed1cacca66e598af8bcd632d465","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"14c9ede9ca4cd078ad76a6ab9617b81074eb58bf","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/hwmon/ftsteutates.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.3","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.3","versionType":"semver"},{"version":"6.6.95","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/hwmon/ftsteutates.c"]}],"references":["https://git.kernel.org/stable/c/d95d87841d2a575bed3691884e8fedef57d7710d","https://git.kernel.org/stable/c/83e2ba8971ccd8fc08319fc7593288f070d80a76","https://git.kernel.org/stable/c/4d646f627d3b7ed1cacca66e598af8bcd632d465","https://git.kernel.org/stable/c/14c9ede9ca4cd078ad76a6ab9617b81074eb58bf"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38217.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38217","state":"PUBLISHED","datePublished":"2025-07-04T13:37:34.532Z","dateUpdated":"2026-05-11T21:23:30.209Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.995Z"},"containers":{"cna":{"title":"hwmon: (ftsteutates) Fix TOCTOU race in fts_read()","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"d95d87841d2a575bed3691884e8fedef57d7710d","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"83e2ba8971ccd8fc08319fc7593288f070d80a76","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"4d646f627d3b7ed1cacca66e598af8bcd632d465","versionType":"git"},{"version":"1c5759d8ce054961b454af69568a41e7e3210ee1","status":"affected","lessThan":"14c9ede9ca4cd078ad76a6ab9617b81074eb58bf","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/hwmon/ftsteutates.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.3","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.3","versionType":"semver"},{"version":"6.6.95","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/hwmon/ftsteutates.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/d95d87841d2a575bed3691884e8fedef57d7710d"},{"url":"https://git.kernel.org/stable/c/83e2ba8971ccd8fc08319fc7593288f070d80a76"},{"url":"https://git.kernel.org/stable/c/4d646f627d3b7ed1cacca66e598af8bcd632d465"},{"url":"https://git.kernel.org/stable/c/14c9ede9ca4cd078ad76a6ab9617b81074eb58bf"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T21:23:30.209Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.3","versionEndExcluding":"6.6.95"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.3","versionEndExcluding":"6.12.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.3","versionEndExcluding":"6.15.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.3","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}