]> git.baikalelectronics.ru Git - kernel.git/commit
HID: steam: fix deadlock with input devices.
authorRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Fri, 15 Mar 2019 19:09:10 +0000 (20:09 +0100)
committerJiri Kosina <jkosina@suse.cz>
Mon, 18 Mar 2019 13:44:20 +0000 (14:44 +0100)
commit80cc0ef48e307d1252f165927d643ad0dc47a50e
tree85cbcab21717ac86e29150b177fabf499e7678fc
parentef8e0106f6e270c6724852ddd2698d38aafa57c0
HID: steam: fix deadlock with input devices.

When using this driver with the wireless dongle and some usermode
program that monitors every input device (acpid, for example), while
another usermode client opens and closes the low-level device
repeadedly, the system eventually deadlocks.

The reason is that steam_input_register_device() must not be called with
the mutex held, because the input subsystem has its own synchronization
that clashes with this one: it is possible that steam_input_open() is
called before input_register_device() returns, and since
steam_input_open() needs to lock the mutex, it deadlocks.

However we must hold the mutex when calling any function that sends
commands to the controller. If not, random commands end up falling fail.

Reported-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>
Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tested-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-steam.c