]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Input: fix regression when re-registering input handlers
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 28 Oct 2024 05:31:15 +0000 (22:31 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 3 Nov 2024 05:28:58 +0000 (22:28 -0700)
commit071b24b54d2d05fbf39ddbb27dee08abd1d713f3
treee93ef27dde5ed44a84fef642023d2488f5ab3d76
parent2860586c588ad2dd8747e85ab43c4cf58bb066f4
Input: fix regression when re-registering input handlers

Commit d469647bafd9 ("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: "Ned T. Crigler" <crigler@gmail.com>
Reported-by: Christian Heusel <christian@heusel.eu>
Tested-by: "Ned T. Crigler" <crigler@gmail.com>
Tested-by: Peter Seiderer <ps.report@gmx.net>
Fixes: d469647bafd9 ("Input: simplify event handling logic")
Link: https://lore.kernel.org/r/Zx2iQp6csn42PJA7@xavtug
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/input.c
include/linux/input.h