[PATCH v3 0/2] hwmon: (pmbus) Fix ina233 error handling and isl68137 locking

Pradhan, Sanman posted 2 patches 2 weeks, 3 days ago
drivers/hwmon/pmbus/ina233.c   |  5 ++++-
drivers/hwmon/pmbus/isl68137.c | 21 ++++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
[PATCH v3 0/2] hwmon: (pmbus) Fix ina233 error handling and isl68137 locking
Posted by Pradhan, Sanman 2 weeks, 3 days ago
From: Sanman Pradhan <psanman@juniper.net>

This series addresses review feedback from v2

Patch 1 fixes ina233_read_word_data() which had two problems: the return
value of pmbus_read_word_data() was not checked for errors before use in
arithmetic, and MFR_READ_VSHUNT is a 16-bit two's complement value whose
negative values were treated as large positive numbers. The fix adds an
error check, a (s16) cast for sign extension, and clamp_val() to prevent
negative scaled results from being misinterpreted as errors by the pmbus
core.

Patch 2 adds pmbus_lock_interruptible()/pmbus_unlock() around the custom
avs_enable sysfs show and store callbacks in isl68137, which were
accessing PMBus registers without holding the update_lock mutex. The
store path is especially vulnerable as it performs a multi-step
read-modify-write sequence.

v3:
  - ina233: Added error check, (s16) cast, and clamp_val() per Guenter's
    review (v2 only had the cast, missing both the error check and clamp)
  - isl68137: New patch addressing Sashiko-reported locking issue

v2:
  - ina233: Added (s16) cast for sign extension (no error check)
  - isl68137: Reverted Boolean logic to (val & MASK) == MASK

Sanman Pradhan (2):
  hwmon: (pmbus/ina233) Fix error handling and sign extension in shunt
    voltage read
  hwmon: (pmbus/isl68137) Add mutex protection for AVS enable sysfs
    attributes

 drivers/hwmon/pmbus/ina233.c   |  5 ++++-
 drivers/hwmon/pmbus/isl68137.c | 21 ++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

-- 
2.34.1