media: flexcop-usb: sanity checking of endpoint type
authorOliver Neukum <oneukum@suse.com>
Thu, 24 Sep 2020 11:37:40 +0000 (13:37 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 27 Sep 2020 09:24:50 +0000 (11:24 +0200)
Make sure the endpoint is ISOC in and do not hard code USB_DIR_IN.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/b2c2/flexcop-usb.c
drivers/media/usb/b2c2/flexcop-usb.h

index e3234d1690655c3ca744f6803a380e691633c59e..e4da32771379bbcf96bc3a37e383ee846e041640 100644 (file)
@@ -513,6 +513,8 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
 
        if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
                return -ENODEV;
+       if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc))
+               return -ENODEV;
 
        switch (fc_usb->udev->speed) {
        case USB_SPEED_LOW:
index e86faa0e06ca649b03daf41f848121a756e71111..2f230bf72252be0d022e003e032784b0b5a9dce1 100644 (file)
@@ -15,7 +15,7 @@
 
 #define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev, 0)
 #define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev, 0)
-#define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev, 0x81)
+#define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev, 1)
 
 struct flexcop_usb {
        struct usb_device *udev;