Re: [PATCH RESEND] hwmon: (corsair-psu) Fix linear11 calculation
[email protected] Mon, 03 Aug 2026 23:34:12 +0000
| Newsgroups | org.kernel.vger.linux-hwmon |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: Pre-existing issues: - [High] The driver lacks synchronization for the shared `priv->cmd_buffer`= and `wait_completion` when accessed concurrently via debugfs and sysfs, vi= olating subsystem guidelines. -- --- Patch [1]: [PATCH RESEND] hwmon: (corsair-psu) Fix linear11 calculation= --- (Note: The format of this report is altered to a free-form summary without = inline diff quoting due to recitation restrictions.) commit 1b6cfe916e69e567bfe7403168ee73ecb94923c7 Author: Guenter Roeck <[email protected]> hwmon: (corsair-psu) Fix linear11 calculation This commit fixes the parsing of negative temperatures in Linear11 format by correctly casting the shifted mantissa to s16. It also avoids undefined behavior by replacing bitwise shifts on negative values with multiplication= and division, and clamps the final output to prevent underflow and overflow. [Severity: High] This is a pre-existing issue, but does the driver lack synchronization for = the shared priv->cmd_buffer and wait_completion primitives when accessed concurrently? Looking at corsairpsu_usb_cmd() in drivers/hwmon/corsair-psu.c, the shared command buffer and completion structure are modified and sent without mutual exclusion. Meanwhile, corsairpsu_debugfs_init() creates debugfs attributes (such as "uptime") that bypass the hwmon core lock. If a user or monitoring tool reads these debugfs attributes concurrently wi= th standard sysfs hwmon attributes, could this trigger a data race on the HID command buffer, causing corrupted commands to be sent to the device?=20 Since the subsystem guidelines mandate that drivers must implement their own locking (e.g., hwmon_lock/hwmon_unlock) for attributes registered outside t= he hwmon core, and given that wrong configurations can potentially cause the P= SU to shut down, should a lock be added to protect these shared HID structures? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260803232156.2340= [email protected]?part=3D1