Skip to content

Commit

Permalink
HID: logitech: fix bounds checking on LED report size
Browse files Browse the repository at this point in the history
The check on report size for REPORT_TYPE_LEDS in logi_dj_ll_raw_request()
is wrong; the current check doesn't make any sense -- the report allocated
by HID core in hid_hw_raw_request() can be much larger than
DJREPORT_SHORT_LENGTH, and currently logi_dj_ll_raw_request() doesn't
handle this properly at all.

Fix the check by actually trimming down the report size properly if it is
too large.

Cc: stable@vger.kernel.org
Reported-by: Ben Hawkes <hawkes@google.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Aug 21, 2014
1 parent 29ff665 commit 51217e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-logitech-dj.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static int logi_dj_ll_raw_request(struct hid_device *hid,
if (!out_buf)
return -ENOMEM;

if (count < DJREPORT_SHORT_LENGTH - 2)
if (count > DJREPORT_SHORT_LENGTH - 2)
count = DJREPORT_SHORT_LENGTH - 2;

out_buf[0] = REPORT_ID_DJ_SHORT;
Expand Down

0 comments on commit 51217e6

Please sign in to comment.