• Dmitry Torokhov's avatar
    Input: fix locking issue in /proc/bus/input/ handlers · 1572ca2a
    Dmitry Torokhov authored
    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: default avatariceberg <strakh@ispras.ru>
    Reviewed-by: default avatarJiri Kosina <jkosina@suse.cz>
    Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
    1572ca2a
input.c 43.4 KB