Commit d725d20e authored by Oliver Neukum's avatar Oliver Neukum Committed by Mauro Carvalho Chehab
Browse files

media: flexcop-usb: sanity checking of endpoint type



Make sure the endpoint is ISOC in and do not hard code USB_DIR_IN.

Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent e8897acb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -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;