mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
HID: uhid: Fix sending events with invalid data
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>
This commit is contained in:
parent
1a8b294ce6
commit
adefb69b1b
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user