From: Greg Kroah-Hartman Date: Thu, 9 Dec 2021 21:10:37 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v4.4.295~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3fb486785dfda0cc1642c58c4676ee77211624fc;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch hid-add-usb_hid-dependancy-to-hid-chicony.patch hid-add-usb_hid-dependancy-to-hid-prodikeys.patch hid-bigbenff-prevent-null-pointer-dereference.patch hid-check-for-valid-usb-device-for-many-hid-drivers.patch hid-google-add-eel-usb-id.patch hid-quirks-add-quirk-for-the-microsoft-surface-3-type-cover.patch hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch --- diff --git a/queue-5.10/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch b/queue-5.10/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch new file mode 100644 index 00000000000..73acf725b1a --- /dev/null +++ b/queue-5.10/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch @@ -0,0 +1,115 @@ +From f83baa0cb6cfc92ebaf7f9d3a99d7e34f2e77a8a Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 1 Dec 2021 19:35:01 +0100 +Subject: HID: add hid_is_usb() function to make it simpler for USB detection + +From: Greg Kroah-Hartman + +commit f83baa0cb6cfc92ebaf7f9d3a99d7e34f2e77a8a upstream. + +A number of HID drivers already call hid_is_using_ll_driver() but only +for the detection of if this is a USB device or not. Make this more +obvious by creating hid_is_usb() and calling the function that way. + +Also converts the existing hid_is_using_ll_driver() functions to use the +new call. + +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Cc: linux-input@vger.kernel.org +Cc: stable@vger.kernel.org +Tested-by: Benjamin Tissoires +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211201183503.2373082-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-asus.c | 6 ++---- + drivers/hid/hid-logitech-dj.c | 2 +- + drivers/hid/hid-u2fzero.c | 2 +- + drivers/hid/hid-uclogic-params.c | 3 +-- + drivers/hid/wacom_sys.c | 2 +- + include/linux/hid.h | 5 +++++ + 6 files changed, 11 insertions(+), 9 deletions(-) + +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -918,8 +918,7 @@ static int asus_probe(struct hid_device + if (drvdata->quirks & QUIRK_IS_MULTITOUCH) + drvdata->tp = &asus_i2c_tp; + +- if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && +- hid_is_using_ll_driver(hdev, &usb_hid_driver)) { ++ if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb(hdev)) { + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + + if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { +@@ -947,8 +946,7 @@ static int asus_probe(struct hid_device + drvdata->tp = &asus_t100chi_tp; + } + +- if ((drvdata->quirks & QUIRK_MEDION_E1239T) && +- hid_is_using_ll_driver(hdev, &usb_hid_driver)) { ++ if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) { + struct usb_host_interface *alt = + to_usb_interface(hdev->dev.parent)->altsetting; + +--- a/drivers/hid/hid-logitech-dj.c ++++ b/drivers/hid/hid-logitech-dj.c +@@ -1693,7 +1693,7 @@ static int logi_dj_probe(struct hid_devi + case recvr_type_27mhz: no_dj_interfaces = 2; break; + case recvr_type_bluetooth: no_dj_interfaces = 2; break; + } +- if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) { ++ if (hid_is_usb(hdev)) { + intf = to_usb_interface(hdev->dev.parent); + if (intf && intf->altsetting->desc.bInterfaceNumber >= + no_dj_interfaces) { +--- a/drivers/hid/hid-u2fzero.c ++++ b/drivers/hid/hid-u2fzero.c +@@ -290,7 +290,7 @@ static int u2fzero_probe(struct hid_devi + unsigned int minor; + int ret; + +- if (!hid_is_using_ll_driver(hdev, &usb_hid_driver)) ++ if (!hid_is_usb(hdev)) + return -EINVAL; + + dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); +--- a/drivers/hid/hid-uclogic-params.c ++++ b/drivers/hid/hid-uclogic-params.c +@@ -841,8 +841,7 @@ int uclogic_params_init(struct uclogic_p + struct uclogic_params p = {0, }; + + /* Check arguments */ +- if (params == NULL || hdev == NULL || +- !hid_is_using_ll_driver(hdev, &usb_hid_driver)) { ++ if (params == NULL || hdev == NULL || !hid_is_usb(hdev)) { + rc = -EINVAL; + goto cleanup; + } +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -2217,7 +2217,7 @@ static void wacom_update_name(struct wac + if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) { + char *product_name = wacom->hdev->name; + +- if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { ++ if (hid_is_usb(wacom->hdev)) { + struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); + struct usb_device *dev = interface_to_usbdev(intf); + product_name = dev->product; +--- a/include/linux/hid.h ++++ b/include/linux/hid.h +@@ -833,6 +833,11 @@ static inline bool hid_is_using_ll_drive + return hdev->ll_driver == driver; + } + ++static inline bool hid_is_usb(struct hid_device *hdev) ++{ ++ return hid_is_using_ll_driver(hdev, &usb_hid_driver); ++} ++ + #define PM_HINT_FULLON 1<<5 + #define PM_HINT_NORMAL 1<<1 + diff --git a/queue-5.10/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch b/queue-5.10/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch new file mode 100644 index 00000000000..12b6c4e5511 --- /dev/null +++ b/queue-5.10/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch @@ -0,0 +1,54 @@ +From f237d9028f844a86955fc9da59d7ac4a5c55d7d5 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 2 Dec 2021 12:48:19 +0100 +Subject: HID: add USB_HID dependancy on some USB HID drivers + +From: Greg Kroah-Hartman + +commit f237d9028f844a86955fc9da59d7ac4a5c55d7d5 upstream. + +Some HID drivers are only for USB drivers, yet did not depend on +CONFIG_USB_HID. This was hidden by the fact that the USB functions were +stubbed out in the past, but now that drivers are checking for USB +devices properly, build errors can occur with some random +configurations. + +Reported-by: kernel test robot +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211202114819.2511954-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/Kconfig | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/hid/Kconfig ++++ b/drivers/hid/Kconfig +@@ -214,7 +214,7 @@ config HID_CHICONY + + config HID_CORSAIR + tristate "Corsair devices" +- depends on HID && USB && LEDS_CLASS ++ depends on USB_HID && LEDS_CLASS + help + Support for Corsair devices that are not fully compliant with the + HID standard. +@@ -541,7 +541,7 @@ config HID_LENOVO + + config HID_LOGITECH + tristate "Logitech devices" +- depends on HID ++ depends on USB_HID + depends on LEDS_CLASS + default !EXPERT + help +@@ -889,7 +889,7 @@ config HID_SAITEK + + config HID_SAMSUNG + tristate "Samsung InfraRed remote control or keyboards" +- depends on HID ++ depends on USB_HID + help + Support for Samsung InfraRed remote control or keyboards. + diff --git a/queue-5.10/hid-add-usb_hid-dependancy-to-hid-chicony.patch b/queue-5.10/hid-add-usb_hid-dependancy-to-hid-chicony.patch new file mode 100644 index 00000000000..06be6f9b335 --- /dev/null +++ b/queue-5.10/hid-add-usb_hid-dependancy-to-hid-chicony.patch @@ -0,0 +1,36 @@ +From d080811f27936f712f619f847389f403ac873b8f Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Fri, 3 Dec 2021 08:59:27 +0100 +Subject: HID: add USB_HID dependancy to hid-chicony + +From: Greg Kroah-Hartman + +commit d080811f27936f712f619f847389f403ac873b8f upstream. + +The chicony HID driver only controls USB devices, yet did not have a +dependancy on USB_HID. This causes build errors on some configurations +like sparc when building due to new changes to the chicony driver. + +Reported-by: Stephen Rothwell +Cc: stable@vger.kernel.org +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211203075927.2829218-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hid/Kconfig ++++ b/drivers/hid/Kconfig +@@ -207,7 +207,7 @@ config HID_CHERRY + + config HID_CHICONY + tristate "Chicony devices" +- depends on HID ++ depends on USB_HID + default !EXPERT + help + Support for Chicony Tactical pad and special keys on Chicony keyboards. diff --git a/queue-5.10/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch b/queue-5.10/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch new file mode 100644 index 00000000000..03ea4aa3638 --- /dev/null +++ b/queue-5.10/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch @@ -0,0 +1,36 @@ +From 30cb3c2ad24b66fb7639a6d1f4390c74d6e68f94 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Fri, 3 Dec 2021 09:12:31 +0100 +Subject: HID: add USB_HID dependancy to hid-prodikeys + +From: Greg Kroah-Hartman + +commit 30cb3c2ad24b66fb7639a6d1f4390c74d6e68f94 upstream. + +The prodikeys HID driver only controls USB devices, yet did not have a +dependancy on USB_HID. This causes build errors on some configurations +like nios2 when building due to new changes to the prodikeys driver. + +Reported-by: kernel test robot +Cc: stable@vger.kernel.org +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211203081231.2856936-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hid/Kconfig ++++ b/drivers/hid/Kconfig +@@ -245,7 +245,7 @@ config HID_MACALLY + + config HID_PRODIKEYS + tristate "Prodikeys PC-MIDI Keyboard support" +- depends on HID && SND ++ depends on USB_HID && SND + select SND_RAWMIDI + help + Support for Prodikeys PC-MIDI Keyboard device support. diff --git a/queue-5.10/hid-bigbenff-prevent-null-pointer-dereference.patch b/queue-5.10/hid-bigbenff-prevent-null-pointer-dereference.patch new file mode 100644 index 00000000000..0459e4bc6e9 --- /dev/null +++ b/queue-5.10/hid-bigbenff-prevent-null-pointer-dereference.patch @@ -0,0 +1,32 @@ +From 918aa1ef104d286d16b9e7ef139a463ac7a296f0 Mon Sep 17 00:00:00 2001 +From: Benjamin Tissoires +Date: Thu, 2 Dec 2021 10:53:32 +0100 +Subject: HID: bigbenff: prevent null pointer dereference + +From: Benjamin Tissoires + +commit 918aa1ef104d286d16b9e7ef139a463ac7a296f0 upstream. + +When emulating the device through uhid, there is a chance we don't have +output reports and so report_field is null. + +Cc: stable@vger.kernel.org +Signed-off-by: Benjamin Tissoires +Reviewed-by: Greg Kroah-Hartman +Link: https://lore.kernel.org/r/20211202095334.14399-3-benjamin.tissoires@redhat.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-bigbenff.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hid/hid-bigbenff.c ++++ b/drivers/hid/hid-bigbenff.c +@@ -191,7 +191,7 @@ static void bigben_worker(struct work_st + struct bigben_device, worker); + struct hid_field *report_field = bigben->report->field[0]; + +- if (bigben->removed) ++ if (bigben->removed || !report_field) + return; + + if (bigben->work_led) { diff --git a/queue-5.10/hid-check-for-valid-usb-device-for-many-hid-drivers.patch b/queue-5.10/hid-check-for-valid-usb-device-for-many-hid-drivers.patch new file mode 100644 index 00000000000..0441e82b7b8 --- /dev/null +++ b/queue-5.10/hid-check-for-valid-usb-device-for-many-hid-drivers.patch @@ -0,0 +1,346 @@ +From 93020953d0fa7035fd036ad87a47ae2b7aa4ae33 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 1 Dec 2021 19:35:03 +0100 +Subject: HID: check for valid USB device for many HID drivers + +From: Greg Kroah-Hartman + +commit 93020953d0fa7035fd036ad87a47ae2b7aa4ae33 upstream. + +Many HID drivers assume that the HID device assigned to them is a USB +device as that was the only way HID devices used to be able to be +created in Linux. However, with the additional ways that HID devices +can be created for many different bus types, that is no longer true, so +properly check that we have a USB device associated with the HID device +before allowing a driver that makes this assumption to claim it. + +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Cc: Michael Zaidman +Cc: Stefan Achatz +Cc: Maxime Coquelin +Cc: Alexandre Torgue +Cc: linux-input@vger.kernel.org +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Tested-by: Benjamin Tissoires +[bentiss: amended for thrustmater.c hunk to apply] +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211201183503.2373082-3-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-chicony.c | 8 ++++++-- + drivers/hid/hid-corsair.c | 7 ++++++- + drivers/hid/hid-elan.c | 2 +- + drivers/hid/hid-elo.c | 3 +++ + drivers/hid/hid-holtek-kbd.c | 9 +++++++-- + drivers/hid/hid-holtek-mouse.c | 9 +++++++++ + drivers/hid/hid-lg.c | 10 ++++++++-- + drivers/hid/hid-prodikeys.c | 10 ++++++++-- + drivers/hid/hid-roccat-arvo.c | 3 +++ + drivers/hid/hid-roccat-isku.c | 3 +++ + drivers/hid/hid-roccat-kone.c | 3 +++ + drivers/hid/hid-roccat-koneplus.c | 3 +++ + drivers/hid/hid-roccat-konepure.c | 3 +++ + drivers/hid/hid-roccat-kovaplus.c | 3 +++ + drivers/hid/hid-roccat-lua.c | 3 +++ + drivers/hid/hid-roccat-pyra.c | 3 +++ + drivers/hid/hid-roccat-ryos.c | 3 +++ + drivers/hid/hid-roccat-savu.c | 3 +++ + drivers/hid/hid-samsung.c | 3 +++ + drivers/hid/hid-uclogic-core.c | 3 +++ + 20 files changed, 84 insertions(+), 10 deletions(-) + +--- a/drivers/hid/hid-chicony.c ++++ b/drivers/hid/hid-chicony.c +@@ -58,8 +58,12 @@ static int ch_input_mapping(struct hid_d + static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) + { +- struct usb_interface *intf = to_usb_interface(hdev->dev.parent); +- ++ struct usb_interface *intf; ++ ++ if (!hid_is_usb(hdev)) ++ return rdesc; ++ ++ intf = to_usb_interface(hdev->dev.parent); + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { + /* Change usage maximum and logical maximum from 0x7fff to + * 0x2fff, so they don't exceed HID_MAX_USAGES */ +--- a/drivers/hid/hid-corsair.c ++++ b/drivers/hid/hid-corsair.c +@@ -553,7 +553,12 @@ static int corsair_probe(struct hid_devi + int ret; + unsigned long quirks = id->driver_data; + struct corsair_drvdata *drvdata; +- struct usb_interface *usbif = to_usb_interface(dev->dev.parent); ++ struct usb_interface *usbif; ++ ++ if (!hid_is_usb(dev)) ++ return -EINVAL; ++ ++ usbif = to_usb_interface(dev->dev.parent); + + drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), + GFP_KERNEL); +--- a/drivers/hid/hid-elan.c ++++ b/drivers/hid/hid-elan.c +@@ -50,7 +50,7 @@ struct elan_drvdata { + + static int is_not_elan_touchpad(struct hid_device *hdev) + { +- if (hdev->bus == BUS_USB) { ++ if (hid_is_usb(hdev)) { + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + + return (intf->altsetting->desc.bInterfaceNumber != +--- a/drivers/hid/hid-elo.c ++++ b/drivers/hid/hid-elo.c +@@ -229,6 +229,9 @@ static int elo_probe(struct hid_device * + struct elo_priv *priv; + int ret; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; +--- a/drivers/hid/hid-holtek-kbd.c ++++ b/drivers/hid/hid-holtek-kbd.c +@@ -140,12 +140,17 @@ static int holtek_kbd_input_event(struct + static int holtek_kbd_probe(struct hid_device *hdev, + const struct hid_device_id *id) + { +- struct usb_interface *intf = to_usb_interface(hdev->dev.parent); +- int ret = hid_parse(hdev); ++ struct usb_interface *intf; ++ int ret; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ ++ ret = hid_parse(hdev); + if (!ret) + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + ++ intf = to_usb_interface(hdev->dev.parent); + if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) { + struct hid_input *hidinput; + list_for_each_entry(hidinput, &hdev->inputs, list) { +--- a/drivers/hid/hid-holtek-mouse.c ++++ b/drivers/hid/hid-holtek-mouse.c +@@ -62,6 +62,14 @@ static __u8 *holtek_mouse_report_fixup(s + return rdesc; + } + ++static int holtek_mouse_probe(struct hid_device *hdev, ++ const struct hid_device_id *id) ++{ ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ return 0; ++} ++ + static const struct hid_device_id holtek_mouse_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, + USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, +@@ -83,6 +91,7 @@ static struct hid_driver holtek_mouse_dr + .name = "holtek_mouse", + .id_table = holtek_mouse_devices, + .report_fixup = holtek_mouse_report_fixup, ++ .probe = holtek_mouse_probe, + }; + + module_hid_driver(holtek_mouse_driver); +--- a/drivers/hid/hid-lg.c ++++ b/drivers/hid/hid-lg.c +@@ -769,12 +769,18 @@ static int lg_raw_event(struct hid_devic + + static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) + { +- struct usb_interface *iface = to_usb_interface(hdev->dev.parent); +- __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; ++ struct usb_interface *iface; ++ __u8 iface_num; + unsigned int connect_mask = HID_CONNECT_DEFAULT; + struct lg_drv_data *drv_data; + int ret; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ ++ iface = to_usb_interface(hdev->dev.parent); ++ iface_num = iface->cur_altsetting->desc.bInterfaceNumber; ++ + /* G29 only work with the 1st interface */ + if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) && + (iface_num != 0)) { +--- a/drivers/hid/hid-prodikeys.c ++++ b/drivers/hid/hid-prodikeys.c +@@ -798,12 +798,18 @@ static int pk_raw_event(struct hid_devic + static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) + { + int ret; +- struct usb_interface *intf = to_usb_interface(hdev->dev.parent); +- unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber; ++ struct usb_interface *intf; ++ unsigned short ifnum; + unsigned long quirks = id->driver_data; + struct pk_device *pk; + struct pcmidi_snd *pm = NULL; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ ++ intf = to_usb_interface(hdev->dev.parent); ++ ifnum = intf->cur_altsetting->desc.bInterfaceNumber; ++ + pk = kzalloc(sizeof(*pk), GFP_KERNEL); + if (pk == NULL) { + hid_err(hdev, "can't alloc descriptor\n"); +--- a/drivers/hid/hid-roccat-arvo.c ++++ b/drivers/hid/hid-roccat-arvo.c +@@ -344,6 +344,9 @@ static int arvo_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-isku.c ++++ b/drivers/hid/hid-roccat-isku.c +@@ -324,6 +324,9 @@ static int isku_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-kone.c ++++ b/drivers/hid/hid-roccat-kone.c +@@ -749,6 +749,9 @@ static int kone_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-koneplus.c ++++ b/drivers/hid/hid-roccat-koneplus.c +@@ -431,6 +431,9 @@ static int koneplus_probe(struct hid_dev + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-konepure.c ++++ b/drivers/hid/hid-roccat-konepure.c +@@ -133,6 +133,9 @@ static int konepure_probe(struct hid_dev + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-kovaplus.c ++++ b/drivers/hid/hid-roccat-kovaplus.c +@@ -501,6 +501,9 @@ static int kovaplus_probe(struct hid_dev + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-lua.c ++++ b/drivers/hid/hid-roccat-lua.c +@@ -160,6 +160,9 @@ static int lua_probe(struct hid_device * + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-pyra.c ++++ b/drivers/hid/hid-roccat-pyra.c +@@ -449,6 +449,9 @@ static int pyra_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-ryos.c ++++ b/drivers/hid/hid-roccat-ryos.c +@@ -141,6 +141,9 @@ static int ryos_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-roccat-savu.c ++++ b/drivers/hid/hid-roccat-savu.c +@@ -113,6 +113,9 @@ static int savu_probe(struct hid_device + { + int retval; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-samsung.c ++++ b/drivers/hid/hid-samsung.c +@@ -152,6 +152,9 @@ static int samsung_probe(struct hid_devi + int ret; + unsigned int cmask = HID_CONNECT_DEFAULT; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + ret = hid_parse(hdev); + if (ret) { + hid_err(hdev, "parse failed\n"); +--- a/drivers/hid/hid-uclogic-core.c ++++ b/drivers/hid/hid-uclogic-core.c +@@ -164,6 +164,9 @@ static int uclogic_probe(struct hid_devi + struct uclogic_drvdata *drvdata = NULL; + bool params_initialized = false; + ++ if (!hid_is_usb(hdev)) ++ return -EINVAL; ++ + /* + * libinput requires the pad interface to be on a different node + * than the pen, so use QUIRK_MULTI_INPUT for all tablets. diff --git a/queue-5.10/hid-google-add-eel-usb-id.patch b/queue-5.10/hid-google-add-eel-usb-id.patch new file mode 100644 index 00000000000..13dcebc46dc --- /dev/null +++ b/queue-5.10/hid-google-add-eel-usb-id.patch @@ -0,0 +1,41 @@ +From caff009098e6cf59fd6ac21c3a3befcc854978b4 Mon Sep 17 00:00:00 2001 +From: xiazhengqiao +Date: Fri, 3 Dec 2021 11:01:19 +0800 +Subject: HID: google: add eel USB id + +From: xiazhengqiao + +commit caff009098e6cf59fd6ac21c3a3befcc854978b4 upstream. + +Add one additional hammer-like device. + +Signed-off-by: xiazhengqiao +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211203030119.28612-1-xiazhengqiao@huaqin.corp-partner.google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-google-hammer.c | 2 ++ + drivers/hid/hid-ids.h | 1 + + 2 files changed, 3 insertions(+) + +--- a/drivers/hid/hid-google-hammer.c ++++ b/drivers/hid/hid-google-hammer.c +@@ -529,6 +529,8 @@ static const struct hid_device_id hammer + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) }, + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, ++ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) }, ++ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) }, + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) }, +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -488,6 +488,7 @@ + #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d + #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 + #define USB_DEVICE_ID_GOOGLE_DON 0x5050 ++#define USB_DEVICE_ID_GOOGLE_EEL 0x5057 + + #define USB_VENDOR_ID_GOTOP 0x08f2 + #define USB_DEVICE_ID_SUPER_Q2 0x007f diff --git a/queue-5.10/hid-quirks-add-quirk-for-the-microsoft-surface-3-type-cover.patch b/queue-5.10/hid-quirks-add-quirk-for-the-microsoft-surface-3-type-cover.patch new file mode 100644 index 00000000000..2617ef2e2d0 --- /dev/null +++ b/queue-5.10/hid-quirks-add-quirk-for-the-microsoft-surface-3-type-cover.patch @@ -0,0 +1,51 @@ +From 9003fbe0f3674b972f56fa7e6bf3ac9dbfc4d0ec Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 28 Nov 2021 22:07:48 +0100 +Subject: HID: quirks: Add quirk for the Microsoft Surface 3 type-cover + +From: Hans de Goede + +commit 9003fbe0f3674b972f56fa7e6bf3ac9dbfc4d0ec upstream. + +Add a HID_QUIRK_NO_INIT_REPORTS quirk for the +Microsoft Surface 3 (non pro) type-cover. + +Trying to init the reports seems to confuse the type-cover and +causes 2 issues: + +1. Despite hid-multitouch sending the command to switch the +touchpad to multitouch mode, it keeps sending events on the +mouse emulation interface. + +2. The touchpad completely stops sending events after a reboot. + +Adding the HID_QUIRK_NO_INIT_REPORTS quirk fixes both issues. + +Signed-off-by: Hans de Goede +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-ids.h | 1 + + drivers/hid/hid-quirks.c | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -865,6 +865,7 @@ + #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 + #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 + #define USB_DEVICE_ID_MS_POWER_COVER 0x07da ++#define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de + #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd + #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb + #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -124,6 +124,7 @@ static const struct hid_device_id hid_qu + { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, diff --git a/queue-5.10/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch b/queue-5.10/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch new file mode 100644 index 00000000000..1eb0218f62d --- /dev/null +++ b/queue-5.10/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch @@ -0,0 +1,75 @@ +From 720ac467204a70308bd687927ed475afb904e11b Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 1 Dec 2021 19:35:02 +0100 +Subject: HID: wacom: fix problems when device is not a valid USB device + +From: Greg Kroah-Hartman + +commit 720ac467204a70308bd687927ed475afb904e11b upstream. + +The wacom driver accepts devices of more than just USB types, but some +code paths can cause problems if the device being controlled is not a +USB device due to a lack of checking. Add the needed checks to ensure +that the USB device accesses are only happening on a "real" USB device, +and not one on some other bus. + +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Cc: linux-input@vger.kernel.org +Cc: stable@vger.kernel.org +Tested-by: Benjamin Tissoires +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Benjamin Tissoires +Link: https://lore.kernel.org/r/20211201183503.2373082-2-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/wacom_sys.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -726,7 +726,7 @@ static void wacom_retrieve_hid_descripto + * Skip the query for this type and modify defaults based on + * interface number. + */ +- if (features->type == WIRELESS) { ++ if (features->type == WIRELESS && intf) { + if (intf->cur_altsetting->desc.bInterfaceNumber == 0) + features->device_type = WACOM_DEVICETYPE_WL_MONITOR; + else +@@ -2448,6 +2448,9 @@ static void wacom_wireless_work(struct w + + wacom_destroy_battery(wacom); + ++ if (!usbdev) ++ return; ++ + /* Stylus interface */ + hdev1 = usb_get_intfdata(usbdev->config->interface[1]); + wacom1 = hid_get_drvdata(hdev1); +@@ -2727,8 +2730,6 @@ static void wacom_mode_change_work(struc + static int wacom_probe(struct hid_device *hdev, + const struct hid_device_id *id) + { +- struct usb_interface *intf = to_usb_interface(hdev->dev.parent); +- struct usb_device *dev = interface_to_usbdev(intf); + struct wacom *wacom; + struct wacom_wac *wacom_wac; + struct wacom_features *features; +@@ -2763,8 +2764,14 @@ static int wacom_probe(struct hid_device + wacom_wac->hid_data.inputmode = -1; + wacom_wac->mode_report = -1; + +- wacom->usbdev = dev; +- wacom->intf = intf; ++ if (hid_is_usb(hdev)) { ++ struct usb_interface *intf = to_usb_interface(hdev->dev.parent); ++ struct usb_device *dev = interface_to_usbdev(intf); ++ ++ wacom->usbdev = dev; ++ wacom->intf = intf; ++ } ++ + mutex_init(&wacom->lock); + INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); + INIT_WORK(&wacom->wireless_work, wacom_wireless_work); diff --git a/queue-5.10/series b/queue-5.10/series index 2578d715c25..d8cb040659c 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1,3 +1,12 @@ usb-gadget-uvc-fix-multiple-opens.patch gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch +hid-quirks-add-quirk-for-the-microsoft-surface-3-type-cover.patch +hid-google-add-eel-usb-id.patch +hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch +hid-add-usb_hid-dependancy-to-hid-prodikeys.patch +hid-add-usb_hid-dependancy-to-hid-chicony.patch +hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch +hid-bigbenff-prevent-null-pointer-dereference.patch +hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch +hid-check-for-valid-usb-device-for-many-hid-drivers.patch