diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-20 01:27:06 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-20 01:27:06 -0400 |
| commit | a952baa034ae7c2e4a66932005cbc7ebbccfe28d (patch) | |
| tree | ff5abe0c77f5b129946300677d9b57b00d926a1e /drivers/input/evdev.c | |
| parent | 5bab188a316718a26346cdb25c4cc6b319f8f907 (diff) | |
| parent | 97eb3f24352ec6632c2127b35d8087d2a809a9b9 (diff) | |
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.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index c8471a2552e..7f42d3a454d 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, | |||
| 321 | struct input_event event; | 321 | struct input_event event; |
| 322 | int retval; | 322 | int retval; |
| 323 | 323 | ||
| 324 | if (count < input_event_size()) | ||
| 325 | return -EINVAL; | ||
| 326 | |||
| 324 | retval = mutex_lock_interruptible(&evdev->mutex); | 327 | retval = mutex_lock_interruptible(&evdev->mutex); |
| 325 | if (retval) | 328 | if (retval) |
| 326 | return retval; | 329 | return retval; |
| @@ -330,17 +333,16 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer, | |||
| 330 | goto out; | 333 | goto out; |
| 331 | } | 334 | } |
| 332 | 335 | ||
| 333 | while (retval < count) { | 336 | do { |
| 334 | |||
| 335 | if (input_event_from_user(buffer + retval, &event)) { | 337 | if (input_event_from_user(buffer + retval, &event)) { |
| 336 | retval = -EFAULT; | 338 | retval = -EFAULT; |
| 337 | goto out; | 339 | goto out; |
| 338 | } | 340 | } |
| 341 | retval += input_event_size(); | ||
| 339 | 342 | ||
| 340 | input_inject_event(&evdev->handle, | 343 | input_inject_event(&evdev->handle, |
| 341 | event.type, event.code, event.value); | 344 | event.type, event.code, event.value); |
| 342 | retval += input_event_size(); | 345 | } while (retval + input_event_size() <= count); |
| 343 | } | ||
| 344 | 346 | ||
| 345 | out: | 347 | out: |
| 346 | mutex_unlock(&evdev->mutex); | 348 | mutex_unlock(&evdev->mutex); |
