Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: logitech-hidpp: work flush with I/O stopped in
hidpp_probe()
--
commit 43c05e6ba16082cedbdbc71e25086acb4e9b0851
Author: Dmitry Torokhov [off-list ref]
HID: logitech-hidpp: disable works before stopping transport
This commit synchronously disables hidpp->work and
hidpp->reset_hi_res_work before closing and stopping the HID transport
during probe failure and device removal.
quoted hunk ↗ jump to hunk
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index d5f53b35ac6f5..0e1a9fd98fafc 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -4805,13 +4805,13 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
return ret;
hid_hw_init_fail:
+ disable_work_sync(&hidpp->work);
+ disable_work_sync(&hidpp->reset_hi_res_work);
hid_hw_close(hdev);
[Severity: Medium]
Can disable_work_sync() here stall waiting for in-flight work items while
device I/O is stopped?
In hidpp_probe(), hid_device_io_start() enables incoming reports during
device initialization, which can schedule hidpp->work or
hidpp->reset_hi_res_work. Before calling hid_connect(), hidpp_probe()
calls hid_device_io_stop(), acquiring hdev->driver_input_lock. If
hid_connect() fails and jumps to hid_hw_init_fail, disable_work_sync()
waits for those work handlers with hdev->driver_input_lock held, so any
synchronous HID++ command inside hidpp_connect_event() or
hidpp_reset_hi_res_handler() cannot receive its reply report and stalls
until each 5-second command timeout expires. Should hid_hw_init_fail
bracket disable_work_sync() with hid_device_io_start() and
hid_device_io_stop() like hidpp_remove() does?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-hid-logitech-hidpp-v3-0-cfe2caa1d0eb@gmail.com?part=4