[PATCH] [regression] hid-core: Do not discard truncated input reports

Adam Kropelin <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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 
cd6104572bca9e4afe0dcdb8ecd65ef90b01297b.

This patch restores the previous behavior and fixes the regression.

Signed-off-by: Adam Kropelin <[email protected]>

---
I consider this patch critical for 2.6.21 as it fixes a regression that
real users are reporting.


--- linux-2.6.21-rc5-git13.orig/drivers/hid/hid-core.c	2007-04-05 09:30:18.000000000 -0400
+++ linux-2.6.21-rc5-git13/drivers/hid/hid-core.c	2007-04-05 09:36:07.000000000 -0400
@@ -969,7 +969,7 @@
 
 	if (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)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.