diff options
author | Vladis Dronov <vdronov@redhat.com> | 2016-01-31 11:14:52 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-20 14:58:54 -0400 |
commit | d5468d7afaa9c9e961e150f0455a14a9f4872a98 (patch) | |
tree | 8e5526795b8650ce7cd5a9414717dc494e01f6a4 | |
parent | 2c1f6951a8a82e6de0d82b1158b5e493fc6c54ab (diff) |
[media] usbvision: revert commit 588afcc1
Commit 588afcc1c0e4 ("[media] usbvision fix overflow of interfaces
array")' should be reverted, because:
* "!dev->actconfig->interface[ifnum]" won't catch a case where the value
is not NULL but some garbage. This way the system may crash later with
GPF.
* "(ifnum >= USB_MAXINTERFACES)" does not cover all the error
conditions. "ifnum" should be compared to "dev->actconfig->
desc.bNumInterfaces", i.e. compared to the number of "struct
usb_interface" kzalloc()-ed, not to USB_MAXINTERFACES.
* There is a "struct usb_device" leak in this error path, as there is
usb_get_dev(), but no usb_put_dev() on this path.
* There is a bug of the same type several lines below with number of
endpoints. The code is accessing hard-coded second endpoint
("interface->endpoint[1].desc") which may not exist. It would be great
to handle this in the same patch too.
* All the concerns above are resolved by already-accepted commit fa52bd50
("[media] usbvision: fix crash on detecting device with invalid
configuration")
* Mailing list message:
http://www.spinics.net/lists/linux-media/msg94832.html
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v4.5
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/usb/usbvision/usbvision-video.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index 12f5ebbd0436..ad2f3d27b266 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c | |||
@@ -1452,13 +1452,6 @@ static int usbvision_probe(struct usb_interface *intf, | |||
1452 | printk(KERN_INFO "%s: %s found\n", __func__, | 1452 | printk(KERN_INFO "%s: %s found\n", __func__, |
1453 | usbvision_device_data[model].model_string); | 1453 | usbvision_device_data[model].model_string); |
1454 | 1454 | ||
1455 | /* | ||
1456 | * this is a security check. | ||
1457 | * an exploit using an incorrect bInterfaceNumber is known | ||
1458 | */ | ||
1459 | if (ifnum >= USB_MAXINTERFACES || !dev->actconfig->interface[ifnum]) | ||
1460 | return -ENODEV; | ||
1461 | |||
1462 | if (usbvision_device_data[model].interface >= 0) | 1455 | if (usbvision_device_data[model].interface >= 0) |
1463 | interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0]; | 1456 | interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0]; |
1464 | else if (ifnum < dev->actconfig->desc.bNumInterfaces) | 1457 | else if (ifnum < dev->actconfig->desc.bNumInterfaces) |