linux/drivers/media/usb
Alistair Strachan 1ea04ca97a media: uvcvideo: Fix 'type' check leading to overflow
commit 47bb117911 upstream.

When initially testing the Camera Terminal Descriptor wTerminalType
field (buffer[4]), no mask is used. Later in the function, the MSB is
overloaded to store the descriptor subtype, and so a mask of 0x7fff
is used to check the type.

If a descriptor is specially crafted to set this overloaded bit in the
original wTerminalType field, the initial type check will fail (falling
through, without adjusting the buffer size), but the later type checks
will pass, assuming the buffer has been made suitably large, causing an
overflow.

Avoid this problem by checking for the MSB in the wTerminalType field.
If the bit is set, assume the descriptor is bad, and abort parsing it.

Originally reported here:
https://groups.google.com/forum/#!topic/syzkaller/Ot1fOE6v1d8
A similar (non-compiling) patch was provided at that time.

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-07-09 22:04:20 +01:00
..
au0828 [media] sound: simplify au0828 quirk table 2015-01-05 13:48:32 +00:00
b2c2 [media] drivers: media: usb: b2c2: use usb_*_coherent() instead of pci_*_consistent() in flexcop-usb.c 2013-10-17 11:26:41 -03:00
cpia2 media: cpia2: Fix a couple off by one bugs 2018-06-16 22:21:42 +01:00
cx231xx media: cx231xx: fix potential sign-extension overflow on large shift 2019-02-11 17:53:30 +00:00
dvb-usb media: cxusb, dib0700: ignore XC2028_I2C_FLUSH 2018-06-16 22:22:02 +01:00
dvb-usb-v2 media: rtl28xxu: be sure that it won't go past the array size 2018-12-16 22:08:40 +00:00
em28xx media: em28xx: Fix use-after-free when disconnecting 2019-05-02 21:42:02 +01:00
gspca gspca: konica: add missing endpoint sanity check 2017-08-26 02:14:28 +01:00
hdpvr [media] hdpvr: fix two audio bugs 2014-07-04 15:13:02 -03:00
pvrusb2 pvrusb2: reduce stack usage pvr2_eeprom_analyze() 2017-08-26 02:14:23 +01:00
pwc pwc: Add USB id for Philips Spc880nc webcam 2016-05-01 00:05:45 +02:00
s2255 [media] s2255drv: fix payload size for JPG, MJPEG 2014-12-10 17:49:37 +00:00
siano siano: make it work again with CONFIG_VMAP_STACK 2017-03-16 02:27:13 +00:00
stk1160 [media] stk1160: Make sure current buffer is released 2015-05-05 11:09:42 +01:00
stkwebcam [media] Add HCL T12Rg-H to STK webcam upside-down table 2013-09-26 07:15:49 -03:00
tlg2300 [media] Convert to snd_card_new() with a device pointer 2014-02-14 08:14:09 +01:00
tm6000 [media] v4l: subdev: Move [gs]_std operation to video ops 2014-05-24 17:11:26 -03:00
ttusb-budget [media] ttusb-budget: fix memory leak in ttusb_probe() 2013-06-21 15:06:51 -03:00
ttusb-dec [media] ttusb-dec: buffer overflow in ioctl 2014-11-20 09:55:20 +00:00
usbtv [media] vb2: stop_streaming should return void 2014-04-23 10:12:51 -03:00
usbvision usbvision: fix NULL-deref at probe 2017-08-26 02:14:29 +01:00
uvc media: uvcvideo: Fix 'type' check leading to overflow 2019-07-09 22:04:20 +01:00
zr364xx zr364xx: enforce minimum size when reading header 2017-08-26 02:14:33 +01:00
Kconfig [media] sn9c102: prepare for removal by moving it to staging 2013-12-20 13:41:36 -02:00
Makefile [media] sn9c102: prepare for removal by moving it to staging 2013-12-20 13:41:36 -02:00