aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 51330363c0eb..535fea4fe67f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -28,7 +28,7 @@ struct evdev {
28 int minor; 28 int minor;
29 struct input_handle handle; 29 struct input_handle handle;
30 wait_queue_head_t wait; 30 wait_queue_head_t wait;
31 struct evdev_client *grab; 31 struct evdev_client __rcu *grab;
32 struct list_head client_list; 32 struct list_head client_list;
33 spinlock_t client_lock; /* protects client_list */ 33 spinlock_t client_lock; /* protects client_list */
34 struct mutex mutex; 34 struct mutex mutex;
@@ -669,6 +669,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
669 669
670 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { 670 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
671 671
672 if (!dev->absinfo)
673 return -EINVAL;
674
672 t = _IOC_NR(cmd) & ABS_MAX; 675 t = _IOC_NR(cmd) & ABS_MAX;
673 abs = dev->absinfo[t]; 676 abs = dev->absinfo[t];
674 677
@@ -680,10 +683,13 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
680 } 683 }
681 } 684 }
682 685
683 if (_IOC_DIR(cmd) == _IOC_READ) { 686 if (_IOC_DIR(cmd) == _IOC_WRITE) {
684 687
685 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { 688 if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
686 689
690 if (!dev->absinfo)
691 return -EINVAL;
692
687 t = _IOC_NR(cmd) & ABS_MAX; 693 t = _IOC_NR(cmd) & ABS_MAX;
688 694
689 if (copy_from_user(&abs, p, min_t(size_t, 695 if (copy_from_user(&abs, p, min_t(size_t,