Skip to content
Commit 071b24b5 authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

Input: fix regression when re-registering input handlers



Commit d469647b ("Input: simplify event handling logic") introduced
code that would set handler->events() method to either
input_handler_events_filter() or input_handler_events_default() or
input_handler_events_null(), depending on the kind of input handler
(a filter or a regular one) we are dealing with. Unfortunately this
breaks cases when we try to re-register the same filter (as is the case
with sysrq handler): after initial registration the handler will have 2
event handling methods defined, and will run afoul of the check in
input_handler_check_methods():

	input: input_handler_check_methods: only one event processing method can be defined (sysrq)
	sysrq: Failed to register input handler, error -22

Fix this by adding handle_events() method to input_handle structure and
setting it up when registering a new input handle according to event
handling methods defined in associated input_handler structure, thus
avoiding modifying the input_handler structure.

Reported-by: default avatar"Ned T. Crigler" <crigler@gmail.com>
Reported-by: default avatarChristian Heusel <christian@heusel.eu>
Tested-by: default avatar"Ned T. Crigler" <crigler@gmail.com>
Tested-by: default avatarPeter Seiderer <ps.report@gmx.net>
Fixes: d469647b ("Input: simplify event handling logic")
Link: https://lore.kernel.org/r/Zx2iQp6csn42PJA7@xavtug


Cc: stable@vger.kernel.org
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 2860586c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment