aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2011-02-03 02:04:27 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-02-03 02:04:27 -0500
commit9ae4345a46bdb148e32a547e89ff29563a11e127 (patch)
treea451adbb46c8f1838bf234be11cb3233e25fa2da /drivers
parent7ab7b5adfb923978a2cab7bd3fac9ccf7d21cc3f (diff)
Revert "Input: do not pass injected events back to the originating handler"
This reverts commit 5fdbe44d033d059cc56c2803e6b4dbd8cb4e5e39. Apparently there exist userspace programs that expect to be able to "loop back" and distribute to readers events written into /dev/input/eventX and this change made for the benefit of SysRq handler broke them. Now that SysRq uses alternative method to suppress filtering of the events it re-injects we can safely revert this change. Reported-by: Kristen Carlson Accardi <kristen@linux.intel.com> Cc: stable@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index f37da09a5e4c..b8894a059f87 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -76,7 +76,6 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz)
76 * dev->event_lock held and interrupts disabled. 76 * dev->event_lock held and interrupts disabled.
77 */ 77 */
78static void input_pass_event(struct input_dev *dev, 78static void input_pass_event(struct input_dev *dev,
79 struct input_handler *src_handler,
80 unsigned int type, unsigned int code, int value) 79 unsigned int type, unsigned int code, int value)
81{ 80{
82 struct input_handler *handler; 81 struct input_handler *handler;
@@ -95,15 +94,6 @@ static void input_pass_event(struct input_dev *dev,
95 continue; 94 continue;
96 95
97 handler = handle->handler; 96 handler = handle->handler;
98
99 /*
100 * If this is the handler that injected this
101 * particular event we want to skip it to avoid
102 * filters firing again and again.
103 */
104 if (handler == src_handler)
105 continue;
106
107 if (!handler->filter) { 97 if (!handler->filter) {
108 if (filtered) 98 if (filtered)
109 break; 99 break;
@@ -133,7 +123,7 @@ static void input_repeat_key(unsigned long data)
133 if (test_bit(dev->repeat_key, dev->key) && 123 if (test_bit(dev->repeat_key, dev->key) &&
134 is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { 124 is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) {
135 125
136 input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2); 126 input_pass_event(dev, EV_KEY, dev->repeat_key, 2);
137 127
138 if (dev->sync) { 128 if (dev->sync) {
139 /* 129 /*
@@ -142,7 +132,7 @@ static void input_repeat_key(unsigned long data)
142 * Otherwise assume that the driver will send 132 * Otherwise assume that the driver will send
143 * SYN_REPORT once it's done. 133 * SYN_REPORT once it's done.
144 */ 134 */
145 input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 135 input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
146 } 136 }
147 137
148 if (dev->rep[REP_PERIOD]) 138 if (dev->rep[REP_PERIOD])
@@ -175,7 +165,6 @@ static void input_stop_autorepeat(struct input_dev *dev)
175#define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) 165#define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE)
176 166
177static int input_handle_abs_event(struct input_dev *dev, 167static int input_handle_abs_event(struct input_dev *dev,
178 struct input_handler *src_handler,
179 unsigned int code, int *pval) 168 unsigned int code, int *pval)
180{ 169{
181 bool is_mt_event; 170 bool is_mt_event;
@@ -219,15 +208,13 @@ static int input_handle_abs_event(struct input_dev *dev,
219 /* Flush pending "slot" event */ 208 /* Flush pending "slot" event */
220 if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { 209 if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) {
221 input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); 210 input_abs_set_val(dev, ABS_MT_SLOT, dev->slot);
222 input_pass_event(dev, src_handler, 211 input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot);
223 EV_ABS, ABS_MT_SLOT, dev->slot);
224 } 212 }
225 213
226 return INPUT_PASS_TO_HANDLERS; 214 return INPUT_PASS_TO_HANDLERS;
227} 215}
228 216
229static void input_handle_event(struct input_dev *dev, 217static void input_handle_event(struct input_dev *dev,
230 struct input_handler *src_handler,
231 unsigned int type, unsigned int code, int value) 218 unsigned int type, unsigned int code, int value)
232{ 219{
233 int disposition = INPUT_IGNORE_EVENT; 220 int disposition = INPUT_IGNORE_EVENT;
@@ -280,8 +267,7 @@ static void input_handle_event(struct input_dev *dev,
280 267
281 case EV_ABS: 268 case EV_ABS:
282 if (is_event_supported(code, dev->absbit, ABS_MAX)) 269 if (is_event_supported(code, dev->absbit, ABS_MAX))
283 disposition = input_handle_abs_event(dev, src_handler, 270 disposition = input_handle_abs_event(dev, code, &value);
284 code, &value);
285 271
286 break; 272 break;
287 273
@@ -339,7 +325,7 @@ static void input_handle_event(struct input_dev *dev,
339 dev->event(dev, type, code, value); 325 dev->event(dev, type, code, value);
340 326
341 if (disposition & INPUT_PASS_TO_HANDLERS) 327 if (disposition & INPUT_PASS_TO_HANDLERS)
342 input_pass_event(dev, src_handler, type, code, value); 328 input_pass_event(dev, type, code, value);
343} 329}
344 330
345/** 331/**
@@ -368,7 +354,7 @@ void input_event(struct input_dev *dev,
368 354
369 spin_lock_irqsave(&dev->event_lock, flags); 355 spin_lock_irqsave(&dev->event_lock, flags);
370 add_input_randomness(type, code, value); 356 add_input_randomness(type, code, value);
371 input_handle_event(dev, NULL, type, code, value); 357 input_handle_event(dev, type, code, value);
372 spin_unlock_irqrestore(&dev->event_lock, flags); 358 spin_unlock_irqrestore(&dev->event_lock, flags);
373 } 359 }
374} 360}
@@ -398,8 +384,7 @@ void input_inject_event(struct input_handle *handle,
398 rcu_read_lock(); 384 rcu_read_lock();
399 grab = rcu_dereference(dev->grab); 385 grab = rcu_dereference(dev->grab);
400 if (!grab || grab == handle) 386 if (!grab || grab == handle)
401 input_handle_event(dev, handle->handler, 387 input_handle_event(dev, type, code, value);
402 type, code, value);
403 rcu_read_unlock(); 388 rcu_read_unlock();
404 389
405 spin_unlock_irqrestore(&dev->event_lock, flags); 390 spin_unlock_irqrestore(&dev->event_lock, flags);
@@ -612,10 +597,10 @@ static void input_dev_release_keys(struct input_dev *dev)
612 for (code = 0; code <= KEY_MAX; code++) { 597 for (code = 0; code <= KEY_MAX; code++) {
613 if (is_event_supported(code, dev->keybit, KEY_MAX) && 598 if (is_event_supported(code, dev->keybit, KEY_MAX) &&
614 __test_and_clear_bit(code, dev->key)) { 599 __test_and_clear_bit(code, dev->key)) {
615 input_pass_event(dev, NULL, EV_KEY, code, 0); 600 input_pass_event(dev, EV_KEY, code, 0);
616 } 601 }
617 } 602 }
618 input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 603 input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
619 } 604 }
620} 605}
621 606
@@ -890,9 +875,9 @@ int input_set_keycode(struct input_dev *dev,
890 !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && 875 !is_event_supported(old_keycode, dev->keybit, KEY_MAX) &&
891 __test_and_clear_bit(old_keycode, dev->key)) { 876 __test_and_clear_bit(old_keycode, dev->key)) {
892 877
893 input_pass_event(dev, NULL, EV_KEY, old_keycode, 0); 878 input_pass_event(dev, EV_KEY, old_keycode, 0);
894 if (dev->sync) 879 if (dev->sync)
895 input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 880 input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
896 } 881 }
897 882
898 out: 883 out: