瀏覽代碼

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>
Vinicius Costa Gomes 13 年之前
父節點
當前提交
adefb69b1b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/hid/uhid.c

+ 1 - 1
drivers/hid/uhid.c

@@ -465,7 +465,7 @@ try_again:
 		goto try_again;
 		goto try_again;
 	} else {
 	} else {
 		len = min(count, sizeof(**uhid->outq));
 		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;
 			ret = -EFAULT;
 		} else {
 		} else {
 			kfree(uhid->outq[uhid->tail]);
 			kfree(uhid->outq[uhid->tail]);