mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
HID: hiddev: set report-init policy before device registration
usb_register_dev() publishes the hiddev character device before hiddev_connect() initializes the report policy. A process that opens the new node immediately can issue a usage ioctl while initialized is still false and trigger usbhid_init_reports(), bypassing HID_QUIRK_NO_INIT_REPORTS. Set initialized before registering the character device so every opener observes the quirk-selected policy. Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
03f449b5de
commit
45c8ab60f8
|
|
@ -903,6 +903,8 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
|
|||
hid->hiddev = hiddev;
|
||||
hiddev->hid = hid;
|
||||
hiddev->exist = 1;
|
||||
/* Honor NO_INIT_REPORTS before the character device becomes visible. */
|
||||
hiddev->initialized = hid->quirks & HID_QUIRK_NO_INIT_REPORTS;
|
||||
retval = usb_register_dev(usbhid->intf, &hiddev_class);
|
||||
if (retval) {
|
||||
hid_err(hid, "Not able to get a minor for this device\n");
|
||||
|
|
@ -911,12 +913,6 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* If HID_QUIRK_NO_INIT_REPORTS is set, make sure we don't initialize
|
||||
* the reports.
|
||||
*/
|
||||
hiddev->initialized = hid->quirks & HID_QUIRK_NO_INIT_REPORTS;
|
||||
|
||||
hiddev->minor = usbhid->intf->minor;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user