]> git.baikalelectronics.ru Git - kernel.git/commit
[media] usbvision: revert commit 59546b0d
authorVladis Dronov <vdronov@redhat.com>
Sun, 31 Jan 2016 16:14:52 +0000 (14:14 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 20 Apr 2016 18:58:54 +0000 (15:58 -0300)
commit8b59f98a4417f6eb8b8751ac578e809d7125212d
tree8e5526795b8650ce7cd5a9414717dc494e01f6a4
parentdac99946de37cdbf4ac026bcc17c945f2f2ab7d8
[media] usbvision: revert commit 59546b0d

Commit 59546b0dcf7e ("[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 14a4e2c2
("[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>
drivers/media/usb/usbvision/usbvision-video.c