Skip to content

Commit 41c7110

Browse files
aleksamagickagroeck
authored andcommitted
hwmon: (gigabyte_waterforce) Mark status report as received under a spinlock
Through hidraw, userspace can cause a status report to be sent from the device. The parsing in waterforce_raw_event() may happen in parallel to a waterforce_get_status() call (which resets the completion for tracking the report) if it's running on a different CPU where bottom half interrupts are not disabled. Add a spinlock around the complete_all() call in waterforce_raw_event() to prevent race issues. Fixes: d5939a7 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers") Signed-off-by: Aleksa Savic <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 8249a0e commit 41c7110

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/hwmon/gigabyte_waterforce.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ static int waterforce_raw_event(struct hid_device *hdev, struct hid_report *repo
276276
priv->duty_input[0] = data[WATERFORCE_FAN_DUTY];
277277
priv->duty_input[1] = data[WATERFORCE_PUMP_DUTY];
278278

279+
spin_lock(&priv->status_report_request_lock);
279280
if (!completion_done(&priv->status_report_received))
280281
complete_all(&priv->status_report_received);
282+
spin_unlock(&priv->status_report_request_lock);
281283

282284
priv->updated = jiffies;
283285

0 commit comments

Comments
 (0)