diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-15 09:49:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-15 09:49:43 -0700 |
commit | 1bbee7d616d5fdffa6c1c86075dbffe2b3e236ea (patch) | |
tree | d4a7fd43961d1ee97b5323bfc4d75b634d317bf0 /drivers/hid/hidraw.c | |
parent | 264780c29041a147f5cff5dda64d03373e24b972 (diff) | |
parent | 272036edb77e5967c175ac48b8c88e9b3358285f (diff) | |
download | op-kernel-dev-1bbee7d616d5fdffa6c1c86075dbffe2b3e236ea.zip op-kernel-dev-1bbee7d616d5fdffa6c1c86075dbffe2b3e236ea.tar.gz |
Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: Add Cando touch screen 15.6-inch product id
HID: Add MULTI_INPUT quirk for turbox/mosart touchscreen
HID: hidraw, fix a NULL pointer dereference in hidraw_write
HID: hidraw, fix a NULL pointer dereference in hidraw_ioctl
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r-- | drivers/hid/hidraw.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 47d70c5..a3866b5 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -109,6 +109,12 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t int ret = 0; mutex_lock(&minors_lock); + + if (!hidraw_table[minor]) { + ret = -ENODEV; + goto out; + } + dev = hidraw_table[minor]->hid; if (!dev->hid_output_raw_report) { @@ -244,6 +250,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, mutex_lock(&minors_lock); dev = hidraw_table[minor]; + if (!dev) { + ret = -ENODEV; + goto out; + } switch (cmd) { case HIDIOCGRDESCSIZE: @@ -317,6 +327,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, ret = -ENOTTY; } +out: mutex_unlock(&minors_lock); return ret; } |