summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pwm-fan.c
diff options
context:
space:
mode:
authorRobert Hancock <robert.hancock@calian.com>2020-11-03 22:33:15 +0300
committerGuenter Roeck <linux@roeck-us.net>2020-11-04 05:55:56 +0300
commit18e8db7f6526928858dfa99b49d831497f0f8df8 (patch)
tree09fe878553d04e7bc978566c879f8cb689202068 /drivers/hwmon/pwm-fan.c
parent402dab548d0da38b260f3843225cdfd37d91f512 (diff)
downloadlinux-18e8db7f6526928858dfa99b49d831497f0f8df8.tar.xz
hwmon: (pmbus) Add mutex locking for sysfs reads
As part of commit a919ba06979a7 ("hwmon: (pmbus) Stop caching register values"), the update of the sensor value is now triggered directly by the sensor attribute value being read from sysfs. This created (or at least made much more likely) a locking issue, since nothing protected the device page selection from being unexpectedly modified by concurrent reads. If sensor values on different pages on the same device were being concurrently read by multiple threads, this could cause spurious read errors due to the page register not reading back the same value last written, or sensor values being read from the incorrect page. Add locking of the update_lock mutex in pmbus_show_sensor and pmbus_show_samples so that these cannot result in concurrent reads from the underlying device. Fixes: a919ba06979a7 ("hwmon: (pmbus) Stop caching register values") Signed-off-by: Robert Hancock <robert.hancock@calian.com> Reviewed-by: Alex Qiu <xqiu@google.com> Link: https://lore.kernel.org/r/20201103193315.3011800-1-robert.hancock@calian.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pwm-fan.c')
0 files changed, 0 insertions, 0 deletions