]> git.baikalelectronics.ru Git - kernel.git/commit
Input: fix locking issue in /proc/bus/input/ handlers
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 14 Oct 2009 06:37:30 +0000 (23:37 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 14 Oct 2009 07:36:33 +0000 (00:36 -0700)
commit34597e79673f84a2b0ccfcb538775c47a10e10b6
tree1628fd4699c8bd685cef8d47906af7eee05efc7a
parent2f37ed5ac98e3680841b7f5d46b1577ddd00f651
Input: fix locking issue in /proc/bus/input/ handlers

input_devices_seq_start() uses mutex_lock_interruptible() to acquire
the input_mutex, but doesn't properly handle the situation when the
call fails (for example due to interrupt). Instead of returning NULL
(which indicates that there is no more data) we should return
ERR_PTR()-encoded error.

We also need explicit flag indicating whether input_mutex was acquired
since input_devices_seq_stop() is called whether input_devices_seq_start()
was successful or not.

The same applies to input_handlers_seq_start().

Reported-by: iceberg <strakh@ispras.ru>
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/input.c