Skip to content

Commit f39dda9

Browse files
committed
Merge tag 'for-linus-2023060101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - Regression fix for overlong long timeouts during initialization on some Logitech Unifying devices (Bastien Nocera) - error handling and overflow fixes for Wacom driver (Denis Arefev, Jason Gerecke, Nikita Zhandarovich) * tag 'for-linus-2023060101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: logitech-hidpp: Handle timeout differently from busy HID: wacom: Add error check to wacom_parse_and_register() HID: google: add jewel USB id HID: wacom: avoid integer overflow in wacom_intuos_inout() HID: wacom: Check for string overflow from strscpy calls
2 parents ba05959 + 6199d23 commit f39dda9

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

drivers/hid/hid-google-hammer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ static const struct hid_device_id hammer_devices[] = {
586586
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) },
587587
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
588588
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
589+
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
590+
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_JEWEL) },
589591
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
590592
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
591593
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@
529529
#define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
530530
#define USB_DEVICE_ID_GOOGLE_DON 0x5050
531531
#define USB_DEVICE_ID_GOOGLE_EEL 0x5057
532+
#define USB_DEVICE_ID_GOOGLE_JEWEL 0x5061
532533

533534
#define USB_VENDOR_ID_GOTOP 0x08f2
534535
#define USB_DEVICE_ID_SUPER_Q2 0x007f

drivers/hid/hid-logitech-hidpp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp,
314314
dbg_hid("%s:timeout waiting for response\n", __func__);
315315
memset(response, 0, sizeof(struct hidpp_report));
316316
ret = -ETIMEDOUT;
317+
goto exit;
317318
}
318319

319320
if (response->report_id == REPORT_ID_HIDPP_SHORT &&

drivers/hid/wacom_sys.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
22242224
} else if (strstr(product_name, "Wacom") ||
22252225
strstr(product_name, "wacom") ||
22262226
strstr(product_name, "WACOM")) {
2227-
strscpy(name, product_name, sizeof(name));
2227+
if (strscpy(name, product_name, sizeof(name)) < 0) {
2228+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2229+
}
22282230
} else {
22292231
snprintf(name, sizeof(name), "Wacom %s", product_name);
22302232
}
@@ -2242,7 +2244,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
22422244
if (name[strlen(name)-1] == ' ')
22432245
name[strlen(name)-1] = '\0';
22442246
} else {
2245-
strscpy(name, features->name, sizeof(name));
2247+
if (strscpy(name, features->name, sizeof(name)) < 0) {
2248+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2249+
}
22462250
}
22472251

22482252
snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
@@ -2410,8 +2414,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
24102414
goto fail_quirks;
24112415
}
24122416

2413-
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
2417+
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
24142418
error = hid_hw_open(hdev);
2419+
if (error) {
2420+
hid_err(hdev, "hw open failed\n");
2421+
goto fail_quirks;
2422+
}
2423+
}
24152424

24162425
wacom_set_shared_values(wacom_wac);
24172426
devres_close_group(&hdev->dev, wacom);
@@ -2500,8 +2509,10 @@ static void wacom_wireless_work(struct work_struct *work)
25002509
goto fail;
25012510
}
25022511

2503-
strscpy(wacom_wac->name, wacom_wac1->name,
2504-
sizeof(wacom_wac->name));
2512+
if (strscpy(wacom_wac->name, wacom_wac1->name,
2513+
sizeof(wacom_wac->name)) < 0) {
2514+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2515+
}
25052516
}
25062517

25072518
return;

drivers/hid/wacom_wac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
831831
/* Enter report */
832832
if ((data[1] & 0xfc) == 0xc0) {
833833
/* serial number of the tool */
834-
wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
834+
wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
835835
(data[4] << 20) + (data[5] << 12) +
836836
(data[6] << 4) + (data[7] >> 4);
837837

0 commit comments

Comments
 (0)