[media] usbvision fix overflow of interfaces array
authorOliver Neukum <oneukum@suse.com>
Tue, 27 Oct 2015 11:51:34 +0000 (09:51 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 17 Nov 2015 16:56:31 +0000 (14:56 -0200)
This fixes the crash reported in:
http://seclists.org/bugtraq/2015/Oct/35
The interface number needs a sanity check.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/usbvision/usbvision-video.c

index 4aa46caf7e22f8be764bb596622429a76c307f52..3089d640c82d711a2d0d0286bd2f674eec2d6ba7 100644 (file)
@@ -1461,6 +1461,13 @@ static int usbvision_probe(struct usb_interface *intf,
        printk(KERN_INFO "%s: %s found\n", __func__,
                                usbvision_device_data[model].model_string);
 
+       /*
+        * this is a security check.
+        * an exploit using an incorrect bInterfaceNumber is known
+        */
+       if (ifnum >= USB_MAXINTERFACES || !dev->actconfig->interface[ifnum])
+               return -ENODEV;
+
        if (usbvision_device_data[model].interface >= 0)
                interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0];
        else