This is a note to let you know that I've just added the patch titled HID: wacom: fix problems when device is not a valid USB device to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 720ac467204a70308bd687927ed475afb904e11b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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 <gregkh@xxxxxxxxxxxxxxxxxxx> 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 <jikos@xxxxxxxxxx> Cc: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx> Cc: linux-input@xxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx Tested-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx> Link: https://lore.kernel.org/r/20211201183503.2373082-2-gregkh@xxxxxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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 @@ -458,7 +458,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 @@ -1512,6 +1512,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); @@ -1689,8 +1692,6 @@ static void wacom_update_name(struct wac 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; @@ -1733,8 +1734,14 @@ static int wacom_probe(struct hid_device goto fail_type; } - 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->work, wacom_wireless_work); Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.4/hid-wacom-fix-problems-when-device-is-not-a-valid-usb-device.patch queue-4.4/hid-add-usb_hid-dependancy-to-hid-prodikeys.patch queue-4.4/hid-add-usb_hid-dependancy-to-hid-chicony.patch queue-4.4/hid-add-hid_is_usb-function-to-make-it-simpler-for-usb-detection.patch queue-4.4/hid-add-usb_hid-dependancy-on-some-usb-hid-drivers.patch queue-4.4/hid-check-for-valid-usb-device-for-many-hid-drivers.patch queue-4.4/hid-introduce-hid_is_using_ll_driver.patch