Skip to content

Commit 966922f

Browse files
aviscontiJiri Kosina
authored andcommitted
HID: fix a crash in hid_report_raw_event() function.
I'm using a Data Modul EasyTouch USB multitouch controller, which is issuing a hid report with a size equals to 0. The rsize value gets set to 536870912 and Linux is crashing in the memset because the value is too big. Signed-off-by: Armando Visconti <armando.visconti@st.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent fdc6807 commit 966922f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/hid/hid-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,9 @@ void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
10451045

10461046
rsize = ((report->size - 1) >> 3) + 1;
10471047

1048+
if (rsize > HID_MAX_BUFFER_SIZE)
1049+
rsize = HID_MAX_BUFFER_SIZE;
1050+
10481051
if (csize < rsize) {
10491052
dbg_hid("report %d is too short, (%d < %d)\n", report->id,
10501053
csize, rsize);

0 commit comments

Comments
 (0)