Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

Pull HID updates from Jiri Kosina:

- bounds checking fixes in logitech and roccat drivers, from Peter Wu
and Dan Carpenter

- double-kfree fix in i2c-hid driver on bus shutdown, from Mika
Westerberg

- a couple of various small driver fixes

- a few device id additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
HID: Add a new id 0x501a for Genius MousePen i608X
HID: logitech-hidpp: prefix the name with "Logitech"
HID: logitech-hidpp: avoid unintended fall-through
HID: Allow HID_BATTERY_STRENGTH to be enabled
HID: i2c-hid: Do not free buffers in i2c_hid_stop()
HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard
HID: logitech-hidpp: check WTP report length
HID: logitech-dj: check report length

+74 -9
+2 -1
drivers/hid/Kconfig
··· 27 27 28 28 config HID_BATTERY_STRENGTH 29 29 bool "Battery level reporting for HID devices" 30 - depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 30 + depends on HID 31 + select POWER_SUPPLY 31 32 default n 32 33 ---help--- 33 34 This option adds support of reporting battery strength (for HID devices
+1
drivers/hid/hid-core.c
··· 1805 1805 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 1806 1806 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 1807 1807 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 1808 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, 1808 1809 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 1809 1810 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1810 1811 { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
+1
drivers/hid/hid-ids.h
··· 526 526 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 527 527 #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 528 528 #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 529 + #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a 529 530 #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 530 531 531 532 #define USB_VENDOR_ID_LABTEC 0x1020
+3
drivers/hid/hid-input.c
··· 312 312 USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), 313 313 HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 314 314 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), 316 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 317 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 318 USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), 316 319 HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 317 320 {}
+4
drivers/hid/hid-kye.c
··· 323 323 } 324 324 break; 325 325 case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 326 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: 326 327 if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { 327 328 rdesc = mousepen_i608x_rdesc_fixed; 328 329 *rsize = sizeof(mousepen_i608x_rdesc_fixed); ··· 416 415 switch (id->product) { 417 416 case USB_DEVICE_ID_KYE_EASYPEN_I405X: 418 417 case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 418 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: 419 419 case USB_DEVICE_ID_KYE_EASYPEN_M610X: 420 420 ret = kye_tablet_enable(hdev); 421 421 if (ret) { ··· 447 445 USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 448 446 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 449 447 USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 448 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 449 + USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, 450 450 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 451 451 USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 452 452 { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
+15 -1
drivers/hid/hid-logitech-dj.c
··· 962 962 963 963 switch (data[0]) { 964 964 case REPORT_ID_DJ_SHORT: 965 + if (size != DJREPORT_SHORT_LENGTH) { 966 + dev_err(&hdev->dev, "DJ report of bad size (%d)", size); 967 + return false; 968 + } 965 969 return logi_dj_dj_event(hdev, report, data, size); 966 970 case REPORT_ID_HIDPP_SHORT: 967 - /* intentional fallthrough */ 971 + if (size != HIDPP_REPORT_SHORT_LENGTH) { 972 + dev_err(&hdev->dev, 973 + "Short HID++ report of bad size (%d)", size); 974 + return false; 975 + } 976 + return logi_dj_hidpp_event(hdev, report, data, size); 968 977 case REPORT_ID_HIDPP_LONG: 978 + if (size != HIDPP_REPORT_LONG_LENGTH) { 979 + dev_err(&hdev->dev, 980 + "Long HID++ report of bad size (%d)", size); 981 + return false; 982 + } 969 983 return logi_dj_hidpp_event(hdev, report, data, size); 970 984 } 971 985
+41
drivers/hid/hid-logitech-hidpp.c
··· 282 282 (report->rap.sub_id == 0x41); 283 283 } 284 284 285 + /** 286 + * hidpp_prefix_name() prefixes the current given name with "Logitech ". 287 + */ 288 + static void hidpp_prefix_name(char **name, int name_length) 289 + { 290 + #define PREFIX_LENGTH 9 /* "Logitech " */ 291 + 292 + int new_length; 293 + char *new_name; 294 + 295 + if (name_length > PREFIX_LENGTH && 296 + strncmp(*name, "Logitech ", PREFIX_LENGTH) == 0) 297 + /* The prefix has is already in the name */ 298 + return; 299 + 300 + new_length = PREFIX_LENGTH + name_length; 301 + new_name = kzalloc(new_length, GFP_KERNEL); 302 + if (!new_name) 303 + return; 304 + 305 + snprintf(new_name, new_length, "Logitech %s", *name); 306 + 307 + kfree(*name); 308 + 309 + *name = new_name; 310 + } 311 + 285 312 /* -------------------------------------------------------------------------- */ 286 313 /* HIDP++ 1.0 commands */ 287 314 /* -------------------------------------------------------------------------- */ ··· 348 321 return NULL; 349 322 350 323 memcpy(name, &response.rap.params[2], len); 324 + 325 + /* include the terminating '\0' */ 326 + hidpp_prefix_name(&name, len + 1); 327 + 351 328 return name; 352 329 } 353 330 ··· 528 497 } 529 498 index += ret; 530 499 } 500 + 501 + /* include the terminating '\0' */ 502 + hidpp_prefix_name(&name, __name_length + 1); 531 503 532 504 return name; 533 505 } ··· 828 794 829 795 switch (data[0]) { 830 796 case 0x02: 797 + if (size < 2) { 798 + hid_err(hdev, "Received HID report of bad size (%d)", 799 + size); 800 + return 1; 801 + } 831 802 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { 832 803 input_event(wd->input, EV_KEY, BTN_LEFT, 833 804 !!(data[1] & 0x01)); 834 805 input_event(wd->input, EV_KEY, BTN_RIGHT, 835 806 !!(data[1] & 0x02)); 836 807 input_sync(wd->input); 808 + return 0; 837 809 } else { 838 810 if (size < 21) 839 811 return 1; 840 812 return wtp_mouse_raw_xy_event(hidpp, &data[7]); 841 813 } 842 814 case REPORT_ID_HIDPP_LONG: 815 + /* size is already checked in hidpp_raw_event. */ 843 816 if ((report->fap.feature_index != wd->mt_feature_index) || 844 817 (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) 845 818 return 1;
+6 -2
drivers/hid/hid-roccat-pyra.c
··· 35 35 static void profile_activated(struct pyra_device *pyra, 36 36 unsigned int new_profile) 37 37 { 38 + if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) 39 + return; 38 40 pyra->actual_profile = new_profile; 39 41 pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; 40 42 } ··· 259 257 if (off != 0 || count != PYRA_SIZE_SETTINGS) 260 258 return -EINVAL; 261 259 262 - mutex_lock(&pyra->pyra_lock); 263 - 264 260 settings = (struct pyra_settings const *)buf; 261 + if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) 262 + return -EINVAL; 263 + 264 + mutex_lock(&pyra->pyra_lock); 265 265 266 266 retval = pyra_set_settings(usb_dev, settings); 267 267 if (retval) {
-5
drivers/hid/i2c-hid/i2c-hid.c
··· 706 706 707 707 static void i2c_hid_stop(struct hid_device *hid) 708 708 { 709 - struct i2c_client *client = hid->driver_data; 710 - struct i2c_hid *ihid = i2c_get_clientdata(client); 711 - 712 709 hid->claimed = 0; 713 - 714 - i2c_hid_free_buffers(ihid); 715 710 } 716 711 717 712 static int i2c_hid_open(struct hid_device *hid)
+1
drivers/hid/usbhid/hid-quirks.c
··· 124 124 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, 125 125 { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, 126 126 { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, 127 + { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, 127 128 { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, 128 129 { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, 129 130 { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS },