linux/drivers/media
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
..
common [media] siano: add support for PCTV 77e 2014-11-17 14:11:49 +00:00
dvb-core media: dvb_frontend: fix locking issues at dvb_frontend_get_event() 2018-11-20 18:04:47 +00:00
dvb-frontends drxd_hard: fix bad alignments 2018-11-20 18:04:45 +00:00
firewire firewire: introduce fw_driver.probe and .remove methods 2013-06-09 18:15:00 +02:00
i2c media: v4l2: i2c: ov7670: Fix PLL bypass register values 2019-07-09 22:03:47 +01:00
mmc [media] siano: get rid of CammelCase from smscoreapi.h 2013-03-21 10:03:16 -03:00
parport [media] media: parport: Fix format string mismatch in bw-qcam.c 2014-05-23 12:18:53 -03:00
pci media: pci: cx23885: handle adding to list failure 2019-02-11 17:53:22 +00:00
platform media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL 2019-07-09 22:03:47 +01:00
radio [media] si4713: fix Kconfig dependencies 2014-03-28 18:06:55 -03:00
rc ir-core: fix gcc-7 warning on bool arithmetic 2018-11-20 18:06:02 +00:00
tuners xc2028: Fix use-after-free bug properly 2017-02-23 03:54:39 +00:00
usb media: uvcvideo: Fix 'type' check leading to overflow 2019-07-09 22:04:20 +01:00
v4l2-core media: v4l: ioctl: Validate num_planes for debug messages 2019-05-02 21:41:23 +01:00
Kconfig [media] subdev autoselect only works if I2C and I2C_MUX is selected 2013-12-21 06:03:06 -02:00
Makefile [media] move i2c files into drivers/media/i2c 2012-09-06 18:42:54 -03:00
media-device.c media: media-device: Remove duplicated memset() in media_enum_entities() 2014-09-17 09:21:49 -07:00
media-devnode.c [media] media: Use a better owner for the media device 2014-05-13 13:39:00 -03:00
media-entity.c [media] media: Check for active links on pads with MEDIA_PAD_FL_MUST_CONNECT flag 2013-12-04 15:03:45 -02:00