]> Git Repo - linux.git/commitdiff
staging: comedi: check validity of wMaxPacketSize of usb endpoints found
authorAnant Thazhemadam <[email protected]>
Sat, 10 Oct 2020 08:29:32 +0000 (13:59 +0530)
committerGreg Kroah-Hartman <[email protected]>
Sat, 10 Oct 2020 10:37:46 +0000 (12:37 +0200)
While finding usb endpoints in vmk80xx_find_usb_endpoints(), check if
wMaxPacketSize = 0 for the endpoints found.

Some devices have isochronous endpoints that have wMaxPacketSize = 0
(as required by the USB-2 spec).
However, since this doesn't apply here, wMaxPacketSize = 0 can be
considered to be invalid.

Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Anant Thazhemadam <[email protected]>
Cc: stable <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/comedi/drivers/vmk80xx.c

index 65dc6c51037e30edf30b1ad7e0d6eea7c0390e86..7956abcbae22bfdd2294b1220d892763bd431b3a 100644 (file)
@@ -667,6 +667,9 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev)
        if (!devpriv->ep_rx || !devpriv->ep_tx)
                return -ENODEV;
 
+       if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
+               return -EINVAL;
+
        return 0;
 }
 
This page took 0.050334 seconds and 4 git commands to generate.