<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/hwmon/ftsteutates.c, branch v7.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-10-17T12:59:13+00:00</updated>
<entry>
<title>hwmon: (ftsteutates) Rely on subsystem locking</title>
<updated>2025-10-17T12:59:13+00:00</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2025-09-08T03:51:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fa035d98dbaeb45bf3057b171813dc45d0b40c86'/>
<id>urn:sha1:fa035d98dbaeb45bf3057b171813dc45d0b40c86</id>
<content type='text'>
Attribute access is now serialized in the hardware monitoring core,
so locking in the driver code is no longer necessary. Drop it.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Fix TOCTOU race in fts_read()</title>
<updated>2025-06-16T13:30:57+00:00</updated>
<author>
<name>Gui-Dong Han</name>
<email>hanguidong02@gmail.com</email>
</author>
<published>2025-06-06T07:16:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=14c9ede9ca4cd078ad76a6ab9617b81074eb58bf'/>
<id>urn:sha1:14c9ede9ca4cd078ad76a6ab9617b81074eb58bf</id>
<content type='text'>
In the fts_read() function, when handling hwmon_pwm_auto_channels_temp,
the code accesses the shared variable data-&gt;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-&gt;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-&gt;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.

Fixes: 1c5759d8ce05 ("hwmon: (ftsteutates) Replace fanX_source with pwmX_auto_channels_temp")
Cc: stable@vger.kernel.org
Signed-off-by: Gui-Dong Han &lt;hanguidong02@gmail.com&gt;
Link: https://lore.kernel.org/r/20250606071640.501262-1-hanguidong02@gmail.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0</title>
<updated>2024-05-01T14:47:49+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2024-04-30T08:56:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d8a66f3621c2886ad328d9df53349fc10251f583'/>
<id>urn:sha1:d8a66f3621c2886ad328d9df53349fc10251f583</id>
<content type='text'>
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20240430085654.1028864-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Switch i2c drivers back to use .probe()</title>
<updated>2023-06-08T13:41:17+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2023-05-05T13:17:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1975d167869ef03102771d6267582623d6e07058'/>
<id>urn:sha1:1975d167869ef03102771d6267582623d6e07058</id>
<content type='text'>
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20230505131718.1210071-1-u.kleine-koenig@pengutronix.de
[groeck: Added missing change in pmbus/acbel-fsg032.c]
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: ftsteutates: constify pointers to hwmon_channel_info</title>
<updated>2023-04-19T14:08:35+00:00</updated>
<author>
<name>Krzysztof Kozlowski</name>
<email>krzysztof.kozlowski@linaro.org</email>
</author>
<published>2023-04-06T20:30:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=06c3779625378bb1ceb27e83e0366a2bef6707a8'/>
<id>urn:sha1:06c3779625378bb1ceb27e83e0366a2bef6707a8</id>
<content type='text'>
Statically allocated array of pointed to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski &lt;krzysztof.kozlowski@linaro.org&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Add support for fanX_fault attributes</title>
<updated>2023-02-03T15:30:10+00:00</updated>
<author>
<name>Armin Wolf</name>
<email>W_Armin@gmx.de</email>
</author>
<published>2023-01-05T22:51:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c184f377a4cc9078d42563ef0fe3de6ea574b0cf'/>
<id>urn:sha1:c184f377a4cc9078d42563ef0fe3de6ea574b0cf</id>
<content type='text'>
The driver knows internally when a fan is not connected,
but does not export this knowledge to userspace. Use the
standard fanX_fault attributes to notify userspace if a
fan is not connected.

Tested on a Fujitsu DS3401-B1.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20230105225107.58308-4-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Replace fanX_source with pwmX_auto_channels_temp</title>
<updated>2023-02-03T15:30:10+00:00</updated>
<author>
<name>Armin Wolf</name>
<email>W_Armin@gmx.de</email>
</author>
<published>2023-01-05T22:51:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1c5759d8ce054961b454af69568a41e7e3210ee1'/>
<id>urn:sha1:1c5759d8ce054961b454af69568a41e7e3210ee1</id>
<content type='text'>
Replace the nonstandard fanX_source attributes with the standardized
pwmX_auto_channels_temp attributes and document the special behaviour
associated with those attributes.

Tested on a Fujitsu DS3401-B1.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20230105225107.58308-3-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Convert to devm_hwmon_device_register_with_info()</title>
<updated>2023-02-03T15:30:10+00:00</updated>
<author>
<name>Armin Wolf</name>
<email>W_Armin@gmx.de</email>
</author>
<published>2023-01-05T22:51:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dea60ff028befe061a7b4e1effd09bd7b14df9e0'/>
<id>urn:sha1:dea60ff028befe061a7b4e1effd09bd7b14df9e0</id>
<content type='text'>
Convert driver to use devm_hwmon_device_register_with_info()
to reduce module size by ~30%.

Tested on a Fujitsu DS3401-B1.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20230105225107.58308-2-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Use devm_watchdog_register_device()</title>
<updated>2023-02-03T15:30:09+00:00</updated>
<author>
<name>Armin Wolf</name>
<email>W_Armin@gmx.de</email>
</author>
<published>2022-12-24T04:18:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e1515a749276efeff18b091f3367c3e4640ad497'/>
<id>urn:sha1:e1515a749276efeff18b091f3367c3e4640ad497</id>
<content type='text'>
Use devm_watchdog_register_device() to let devres take care
of unregistering the watchdog at device removal. Remove the
now pointless fts_remove() function.

Tested on a Fujitsu DS3401-B1.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20221224041855.83981-4-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (ftsteutates) Fix scaling of measurements</title>
<updated>2023-01-03T21:26:45+00:00</updated>
<author>
<name>Armin Wolf</name>
<email>W_Armin@gmx.de</email>
</author>
<published>2022-12-24T04:18:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ca8fd8c16a8b77dfcf7f6ce52d2c863220693a78'/>
<id>urn:sha1:ca8fd8c16a8b77dfcf7f6ce52d2c863220693a78</id>
<content type='text'>
A user complained that the ftsteutates driver was displaying
bogus values since its introduction. This happens because the
sensor measurements need to be scaled in order to produce
meaningful results:
- the fan speed needs to be multiplied by 60 since its in RPS
- the temperature is in degrees celsius and needs an offset of 64
- the voltage is in 1/256 of 3.3V

The offical datasheet says the voltage needs to be divided by 256,
but this is likely an off-by-one-error, since even the BIOS
devides by 255 (otherwise 3.3V could not be measured).

The voltage channels additionally need a board-specific multiplier,
however this can be done by the driver since its board-specific.

The reason the missing scaling of measurements is the way Fujitsu
used this driver when it was still out-of-tree. Back then, all
scaling was done in userspace by libsensors, even the generic one.

Tested on a Fujitsu DS3401-B1.

Fixes: 08426eda58e0 ("hwmon: Add driver for FTS BMC chip "Teutates"")
Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20221224041855.83981-2-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
</feed>
