Commit 8da7d1ba authored by Adam Kropelin's avatar Adam Kropelin Committed by Jiri Kosina

HID: Do not discard truncated input reports

Truncated reports should not be discarded since it prevents buggy
devices from communicating with userspace.

Prior to the regession introduced in 2.6.20, a shorter-than-expected
report in hid_input_report() was passed thru after having the missing
bytes cleared. This behavior was established over a few patches in the
2.6.early-teens days, including commit
cd610457.

This patch restores the previous behavior and fixes the regression.
Signed-off-by: default avatarAdam Kropelin <akropel1@rochester.rr.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e0f2e3a0
...@@ -969,7 +969,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i ...@@ -969,7 +969,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
if (size < rsize) { if (size < rsize) {
dbg("report %d is too short, (%d < %d)", report->id, size, rsize); dbg("report %d is too short, (%d < %d)", report->id, size, rsize);
return -1; memset(data + size, 0, rsize - size);
} }
if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment