]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: lenovo-go: reject non-USB transports in probe
authorLouis Clinckx <clinckx.louis@gmail.com>
Fri, 15 May 2026 14:57:39 +0000 (14:57 +0000)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 21 May 2026 15:12:54 +0000 (17:12 +0200)
These drivers only match HID_USB_DEVICE() entries and assume the
underlying bus is USB. Make that explicit at probe by rejecting any
non-USB hdev, following the pattern used by other HID drivers.

Signed-off-by: Louis Clinckx <clinckx.louis@gmail.com>
Reviewed-by: Derek J. Clark <derekjoh.clark@gmail.com>
Tested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-lenovo-go-s.c
drivers/hid/hid-lenovo-go.c

index ff1782a751915f59049e34e12d0ca9501baf44c4..0444d84498bd566b5fe60c7500d86d936cc92849 100644 (file)
@@ -1461,6 +1461,9 @@ static int hid_gos_probe(struct hid_device *hdev,
 {
        int ret, ep;
 
+       if (!hid_is_usb(hdev))
+               return -EINVAL;
+
        ret = hid_parse(hdev);
        if (ret) {
                hid_err(hdev, "Parse failed\n");
index d4d26c7833563729fadb484bd5a757a395c32710..3fa1fe83f7e5e73a553e8f5b069dd3ea0cad25dd 100644 (file)
@@ -2419,6 +2419,9 @@ static int hid_go_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
        int ret, ep;
 
+       if (!hid_is_usb(hdev))
+               return -EINVAL;
+
        hdev->quirks |= HID_QUIRK_INPUT_PER_APP | HID_QUIRK_MULTI_INPUT;
 
        ret = hid_parse(hdev);