aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-02 00:54:35 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-02 00:57:48 -0500
commit66d2a5952eab875f1286e04f738ef029afdaf013 (patch)
tree6d30e807108ef7d2a56ec43271c45acc357df699 /include
parent6ee88d713fb75ab191515f66edffa4e866386565 (diff)
Input: keyboard - fix lack of locking when traversing handler->h_list
Keyboard handler should not attempt to traverse handler->h_list on its own, without any locking, otherwise it races with registering and unregistering of input handles which leads to crashes. Introduce input_handler_for_each_handle() helper that allows safely iterate over all handles attached to a particular handler and switch keyboard handler to use it. Reported-by: Jim Paradis <jparadis@redhat.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include')
-rw-r--r--include/linux/input.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 56d8e048c646..db563bbac9dd 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1021,9 +1021,12 @@ struct ff_effect {
1021 * @keycodesize: size of elements in keycode table 1021 * @keycodesize: size of elements in keycode table
1022 * @keycode: map of scancodes to keycodes for this device 1022 * @keycode: map of scancodes to keycodes for this device
1023 * @setkeycode: optional method to alter current keymap, used to implement 1023 * @setkeycode: optional method to alter current keymap, used to implement
1024 * sparse keymaps. If not supplied default mechanism will be used 1024 * sparse keymaps. If not supplied default mechanism will be used.
1025 * The method is being called while holding event_lock and thus must
1026 * not sleep
1025 * @getkeycode: optional method to retrieve current keymap. If not supplied 1027 * @getkeycode: optional method to retrieve current keymap. If not supplied
1026 * default mechanism will be used 1028 * default mechanism will be used. The method is being called while
1029 * holding event_lock and thus must not sleep
1027 * @ff: force feedback structure associated with the device if device 1030 * @ff: force feedback structure associated with the device if device
1028 * supports force feedback effects 1031 * supports force feedback effects
1029 * @repeat_key: stores key code of the last key pressed; used to implement 1032 * @repeat_key: stores key code of the last key pressed; used to implement
@@ -1295,6 +1298,9 @@ void input_unregister_device(struct input_dev *);
1295int __must_check input_register_handler(struct input_handler *); 1298int __must_check input_register_handler(struct input_handler *);
1296void input_unregister_handler(struct input_handler *); 1299void input_unregister_handler(struct input_handler *);
1297 1300
1301int input_handler_for_each_handle(struct input_handler *, void *data,
1302 int (*fn)(struct input_handle *, void *));
1303
1298int input_register_handle(struct input_handle *); 1304int input_register_handle(struct input_handle *);
1299void input_unregister_handle(struct input_handle *); 1305void input_unregister_handle(struct input_handle *);
1300 1306