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 Jiri Kosina committed Jul 20, 2012
1 parent 1a8b294 commit adefb69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/uhid.c
Original file line number Diff line number Diff line change
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 adefb69

Please sign in to comment.