V4L/DVB (11711): gspca - main: Fix a crash when no bandwidth available
authorJean-Francois Moine <moinejf@free.fr>
Tue, 21 Apr 2009 16:57:31 +0000 (13:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 21:20:54 +0000 (18:20 -0300)
When the bandwidth is not wide enough, the transfer endpoint may be set to
the one of the alternate setting 0. This one may be null and this causes a
divide by 0 oops.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index 873e95580407a8479287ff020495c5ee8d340dcc..efa4dd349f608256e819d32c31223d6c75c18ca7 100644 (file)
@@ -449,7 +449,8 @@ static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
        for (i = 0; i < alt->desc.bNumEndpoints; i++) {
                ep = &alt->endpoint[i];
                attr = ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
-               if (attr == xfer)
+               if (attr == xfer
+                   && ep->desc.wMaxPacketSize != 0)
                        return ep;
        }
        return NULL;
This page took 0.031182 seconds and 5 git commands to generate.