From: Greg Kroah-Hartman Date: Thu, 9 Dec 2021 21:00:05 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.4.295~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d97342f021630687c113233a5eb4262cf64c126a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-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-introduce-hid_is_using_ll_driver.patch hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch --- diff --git a/queue-4.9/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch b/queue-4.9/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch new file mode 100644 index 00000000000..268164440fd --- /dev/null +++ b/queue-4.9/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch @@ -0,0 +1,43 @@ +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 +--- + include/linux/hid.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/include/linux/hid.h ++++ b/include/linux/hid.h +@@ -773,6 +773,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-4.9/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch b/queue-4.9/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch new file mode 100644 index 00000000000..f74fdb2fb3e --- /dev/null +++ b/queue-4.9/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 +@@ -183,7 +183,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. +@@ -421,7 +421,7 @@ config HID_LENOVO + + config HID_LOGITECH + tristate "Logitech devices" +- depends on HID ++ depends on USB_HID + default !EXPERT + ---help--- + Support for Logitech devices that are not fully compliant with HID standard. +@@ -730,7 +730,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-4.9/hid-add-usb_hid-dependancy-to-hid-chicony.patch b/queue-4.9/hid-add-usb_hid-dependancy-to-hid-chicony.patch new file mode 100644 index 00000000000..c31cbd3f81e --- /dev/null +++ b/queue-4.9/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 +@@ -176,7 +176,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-4.9/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch b/queue-4.9/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch new file mode 100644 index 00000000000..a50c3d921ba --- /dev/null +++ b/queue-4.9/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 +@@ -194,7 +194,7 @@ config HID_CORSAIR + + 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-4.9/hid-introduce-hid_is_using_ll_driver.patch b/queue-4.9/hid-introduce-hid_is_using_ll_driver.patch new file mode 100644 index 00000000000..cce9cf72682 --- /dev/null +++ b/queue-4.9/hid-introduce-hid_is_using_ll_driver.patch @@ -0,0 +1,128 @@ +From fc2237a724a9e448599076d7d23497f51e2f7441 Mon Sep 17 00:00:00 2001 +From: Jason Gerecke +Date: Mon, 24 Jul 2017 09:46:18 -0700 +Subject: HID: introduce hid_is_using_ll_driver + +From: Jason Gerecke + +commit fc2237a724a9e448599076d7d23497f51e2f7441 upstream. + +Although HID itself is transport-agnostic, occasionally a driver may +want to interact with the low-level transport that a device is connected +through. To do this, we need to know what kind of bus is in use. The +first guess may be to look at the 'bus' field of the 'struct hid_device', +but this field may be emulated in some cases (e.g. uhid). + +More ideally, we can check which ll_driver a device is using. This +function introduces a 'hid_is_using_ll_driver' function and makes the +'struct hid_ll_driver' of the four most common transports accessible +through hid.h. + +Signed-off-by: Jason Gerecke +Acked-By: Benjamin Tissoires +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/i2c-hid/i2c-hid-core.c | 3 ++- + drivers/hid/uhid.c | 3 ++- + drivers/hid/usbhid/hid-core.c | 3 ++- + include/linux/hid.h | 11 +++++++++++ + net/bluetooth/hidp/core.c | 3 ++- + 5 files changed, 19 insertions(+), 4 deletions(-) + +--- a/drivers/hid/i2c-hid/i2c-hid-core.c ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c +@@ -875,7 +875,7 @@ static int i2c_hid_power(struct hid_devi + return 0; + } + +-static struct hid_ll_driver i2c_hid_ll_driver = { ++struct hid_ll_driver i2c_hid_ll_driver = { + .parse = i2c_hid_parse, + .start = i2c_hid_start, + .stop = i2c_hid_stop, +@@ -885,6 +885,7 @@ static struct hid_ll_driver i2c_hid_ll_d + .output_report = i2c_hid_output_report, + .raw_request = i2c_hid_raw_request, + }; ++EXPORT_SYMBOL_GPL(i2c_hid_ll_driver); + + static int i2c_hid_init_irq(struct i2c_client *client) + { +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -372,7 +372,7 @@ static int uhid_hid_output_report(struct + return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT); + } + +-static struct hid_ll_driver uhid_hid_driver = { ++struct hid_ll_driver uhid_hid_driver = { + .start = uhid_hid_start, + .stop = uhid_hid_stop, + .open = uhid_hid_open, +@@ -381,6 +381,7 @@ static struct hid_ll_driver uhid_hid_dri + .raw_request = uhid_hid_raw_request, + .output_report = uhid_hid_output_report, + }; ++EXPORT_SYMBOL_GPL(uhid_hid_driver); + + #ifdef CONFIG_COMPAT + +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -1272,7 +1272,7 @@ static int usbhid_idle(struct hid_device + return hid_set_idle(dev, ifnum, report, idle); + } + +-static struct hid_ll_driver usb_hid_driver = { ++struct hid_ll_driver usb_hid_driver = { + .parse = usbhid_parse, + .start = usbhid_start, + .stop = usbhid_stop, +@@ -1285,6 +1285,7 @@ static struct hid_ll_driver usb_hid_driv + .output_report = usbhid_output_report, + .idle = usbhid_idle, + }; ++EXPORT_SYMBOL_GPL(usb_hid_driver); + + static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id) + { +--- a/include/linux/hid.h ++++ b/include/linux/hid.h +@@ -762,6 +762,17 @@ struct hid_ll_driver { + int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); + }; + ++extern struct hid_ll_driver i2c_hid_ll_driver; ++extern struct hid_ll_driver hidp_hid_driver; ++extern struct hid_ll_driver uhid_hid_driver; ++extern struct hid_ll_driver usb_hid_driver; ++ ++static inline bool hid_is_using_ll_driver(struct hid_device *hdev, ++ struct hid_ll_driver *driver) ++{ ++ return hdev->ll_driver == driver; ++} ++ + #define PM_HINT_FULLON 1<<5 + #define PM_HINT_NORMAL 1<<1 + +--- a/net/bluetooth/hidp/core.c ++++ b/net/bluetooth/hidp/core.c +@@ -734,7 +734,7 @@ static void hidp_stop(struct hid_device + hid->claimed = 0; + } + +-static struct hid_ll_driver hidp_hid_driver = { ++struct hid_ll_driver hidp_hid_driver = { + .parse = hidp_parse, + .start = hidp_start, + .stop = hidp_stop, +@@ -743,6 +743,7 @@ static struct hid_ll_driver hidp_hid_dri + .raw_request = hidp_raw_request, + .output_report = hidp_output_report, + }; ++EXPORT_SYMBOL_GPL(hidp_hid_driver); + + /* This function sets up the hid device. It does not add it + to the HID system. That is done in hidp_add_connection(). */ diff --git a/queue-4.9/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch b/queue-4.9/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch new file mode 100644 index 00000000000..79b6db6d541 --- /dev/null +++ b/queue-4.9/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 +@@ -506,7 +506,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 +@@ -2115,6 +2115,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); +@@ -2354,8 +2357,6 @@ static void wacom_remote_work(struct wor + 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; +@@ -2388,8 +2389,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_WORK(&wacom->wireless_work, wacom_wireless_work); + INIT_WORK(&wacom->battery_work, wacom_battery_work); diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..b2a9de7d640 --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1,6 @@ +hid-introduce-hid_is_using_ll_driver.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-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch