summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2019-04-17 16:39:43 +0200
committerJiri Kosina <jkosina@suse.cz>2019-04-17 16:39:43 +0200
commit59579a8d173ea727561868bbe989f83b2d24216f (patch)
tree616b51771e03df1209e3570ccd59213d8a707cda /drivers/hid
parentHID: u2fzero: fix compiling error in u2fzero_probe() (diff)
downloadlinux-59579a8d173ea727561868bbe989f83b2d24216f.tar.xz
linux-59579a8d173ea727561868bbe989f83b2d24216f.zip
HID: u2fzero: fail probe if not using USB transport
u2fzero driver is USB-only. Therefore we have to give up in ->probe() callback in case we're called with non-USB transport driver bound, otherwise the kernel will crash trying to use USBHID API on a non-USB transport. Fixes: 42337b9d4d958("HID: add driver for U2F Zero built-in LED and RNG") Reported-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-u2fzero.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
index d11a5cb56a0d..95e0807878c7 100644
--- a/drivers/hid/hid-u2fzero.c
+++ b/drivers/hid/hid-u2fzero.c
@@ -286,6 +286,9 @@ static int u2fzero_probe(struct hid_device *hdev,
unsigned int minor;
int ret;
+ if (!hid_is_using_ll_driver(hdev, &usb_hid_driver))
+ return -EINVAL;
+
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;