summaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-19 22:27:06 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-19 22:27:06 -0700
commita952baa034ae7c2e4a66932005cbc7ebbccfe28d (patch)
treeff5abe0c77f5b129946300677d9b57b00d926a1e /drivers/input/evdev.c
parent5bab188a316718a26346cdb25c4cc6b319f8f907 (diff)
parent97eb3f24352ec6632c2127b35d8087d2a809a9b9 (diff)
downloadop-kernel-dev-a952baa034ae7c2e4a66932005cbc7ebbccfe28d.zip
op-kernel-dev-a952baa034ae7c2e4a66932005cbc7ebbccfe28d.tar.gz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (64 commits) Input: tsc2005 - remove 'disable' sysfs attribute Input: tsc2005 - add open/close Input: tsc2005 - handle read errors from SPI layer Input: tsc2005 - do not rearm timer in hardirq handler Input: tsc2005 - don't use work for 'pen up' handling Input: tsc2005 - do not use 0 in place of NULL Input: tsc2005 - use true/false for boolean variables Input: tsc2005 - hide selftest attribute if we can't reset Input: tsc2005 - rework driver initialization code Input: tsc2005 - set up bus type in input device Input: tsc2005 - set up parent device Input: tsc2005 - clear driver data after unbinding Input: tsc2005 - add module description Input: tsc2005 - remove driver banner message Input: tsc2005 - remove incorrect module alias Input: tsc2005 - convert to using dev_pm_ops Input: tsc2005 - use spi_get/set_drvdata() Input: introduce tsc2005 driver Input: xen-kbdfront - move to drivers/input/misc Input: xen-kbdfront - add grant reference for shared page ...
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index c8471a2..7f42d3a 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -321,6 +321,9 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer,
struct input_event event;
int retval;
+ if (count < input_event_size())
+ return -EINVAL;
+
retval = mutex_lock_interruptible(&evdev->mutex);
if (retval)
return retval;
@@ -330,17 +333,16 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer,
goto out;
}
- while (retval < count) {
-
+ do {
if (input_event_from_user(buffer + retval, &event)) {
retval = -EFAULT;
goto out;
}
+ retval += input_event_size();
input_inject_event(&evdev->handle,
event.type, event.code, event.value);
- retval += input_event_size();
- }
+ } while (retval + input_event_size() <= count);
out:
mutex_unlock(&evdev->mutex);
OpenPOWER on IntegriCloud