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)
commit1572ca2a842a839b78780d9074d2f140b31907cc
tree1628fd4699c8bd685cef8d47906af7eee05efc7a
parent94dfb0d6334a281a979fe5bee187a3698a4dc176
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