Skip to content

Commit

Permalink
HID: usbhid: add safety check at _report
Browse files Browse the repository at this point in the history
Add device disconnect check in usbhid_get_raw_report()

Bug 200000762

Change-Id: Ia56a5ba746ee197a0be967f4cb09e38e44be8a8f
Signed-off-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-on: http://git-master/r/404650
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Tao Xie <txie@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
  • Loading branch information
Vinayak Pane authored and tly82 committed May 15, 2014
1 parent 21e8fe3 commit dd289fb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/hid/usbhid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,12 +908,21 @@ static int usbhid_get_raw_report(struct hid_device *hid,
unsigned char report_type)
{
struct usbhid_device *usbhid = hid->driver_data;
struct usb_device *dev = hid_to_usb_dev(hid);
struct usb_interface *intf = usbhid->intf;
struct usb_host_interface *interface = intf->cur_altsetting;
struct usb_device *dev;
struct usb_interface *intf;
struct usb_host_interface *interface;
int skipped_report_id = 0;
int ret;

if (test_bit(HID_DISCONNECTED, &usbhid->iofl)) {
pr_err("hid device disconnected\n");
return -ESHUTDOWN;
}

dev = hid_to_usb_dev(hid);
intf = usbhid->intf;
interface = intf->cur_altsetting;

/* Byte 0 is the report number. Report data starts at byte 1.*/
buf[0] = report_number;
if (report_number == 0x0) {
Expand Down

0 comments on commit dd289fb

Please sign in to comment.