]> git.baikalelectronics.ru Git - kernel.git/commit
HID: fix a lockup regression when using force feedback on a PID device
authorAnssi Hannula <anssi.hannula@gmail.com>
Sat, 4 Oct 2008 12:44:06 +0000 (14:44 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 14 Oct 2008 21:51:02 +0000 (23:51 +0200)
commit002b9946b2a2212126ab050650c4b8aaf00cc8ba
tree4a2b72a2f98b19efeb5e28837ed1bfacffbbc961
parent258d977973813df7ed57747462a9ca3ccc294537
HID: fix a lockup regression when using force feedback on a PID device

Commit 9856c17cc5a224a8557d25d05c3545c895d2d1c7 introduced a spinlock in
input_dev->event_lock, which is locked when handling input events.
However, the hid-pidff driver sleeps when handling events as it waits for
reports being sent to the device before changing the report contents
again.
This causes a system lockup when trying to use force feedback with a PID
device, a regression introduced in 2.6.24 and 2.6.23.15.

Fix it by extracting the raw report data from struct hid_report
immediately when hid_submit_report() is called, therefore allowing
drivers to change the contents of struct hid_report immediately without
affecting the already-queued transfer.

In hid-pidff, re-add the removed usbhid_wait_io() to
pidff_erase_effect() instead, to prevent a full report queue from causing
the submission to fail, thus not freeing up device memory.
pidff_erase_effect() is not called while dev->event_lock is held.

Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-pidff.c
drivers/hid/usbhid/usbhid.h
include/linux/hid.h