linux/drivers/media/usb/gspca
Johan Hovold e7cd85f398 media: xirlink_cit: add missing descriptor sanity checks
commit a246b4d547 upstream.

Make sure to check that we have two alternate settings and at least one
endpoint before accessing the second altsetting structure and
dereferencing the endpoint arrays.

This specifically avoids dereferencing NULL-pointers or corrupting
memory when a device does not have the expected descriptors.

Note that the sanity check in cit_get_packet_size() is not redundant as
the driver is mixing looking up altsettings by index and by number,
which may not coincide.

Fixes: 659fefa0eb ("V4L/DVB: gspca_xirlink_cit: Add support for camera with a bcd version of 0.01")
Fixes: 59f8b0bf3c ("V4L/DVB: gspca_xirlink_cit: support bandwidth changing for devices with 1 alt setting")
Cc: stable <stable@vger.kernel.org>     # 2.6.37
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-01 11:02:18 +02:00
..
gl860
m5602
stv06xx
Kconfig
Makefile
autogain_functions.c
benq.c
conex.c
cpia1.c
dtcs033.c
etoms.c
finepix.c
gspca.c
gspca.h
jeilinj.c
jl2005bcd.c
jpeg.h
kinect.c
konica.c
mars.c
mr97310a.c
nw80x.c
ov519.c
ov534.c
ov534_9.c
pac207.c
pac7302.c
pac7311.c
pac_common.h
se401.c
se401.h
sn9c20x.c
sn9c2028.c
sn9c2028.h
sonixb.c
sonixj.c
spca500.c
spca501.c
spca505.c
spca506.c
spca508.c
spca561.c
spca1528.c
sq905.c
sq905c.c
sq930x.c
stk014.c
stk1135.c
stk1135.h
stv0680.c
sunplus.c
t613.c
topro.c
touptek.c
tv8532.c
vc032x.c
vicam.c
w996Xcf.c
xirlink_cit.c
zc3xx-reg.h
zc3xx.c