Skip to content

Commit

Permalink
HID: uhid: Fix sending events with invalid data
Browse files Browse the repository at this point in the history
This was detected because events with invalid types were arriving
to userspace.

The code before this patch would only work for the first event in the
queue (when uhid->tail is 0).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Reviewed-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
vcgomes authored and shayneholmes committed Apr 10, 2013
1 parent 405fd74 commit 5d4c3dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/uhid.c
Expand Up @@ -465,7 +465,7 @@ static ssize_t uhid_char_read(struct file *file, char __user *buffer,
goto try_again;
} else {
len = min(count, sizeof(**uhid->outq));
if (copy_to_user(buffer, &uhid->outq[uhid->tail], len)) {
if (copy_to_user(buffer, uhid->outq[uhid->tail], len)) {
ret = -EFAULT;
} else {
kfree(uhid->outq[uhid->tail]);
Expand Down

0 comments on commit 5d4c3dd

Please sign in to comment.