summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/gspca
diff options
context:
space:
mode:
authorJohan Hovold2017-03-13 13:53:59 +0100
committerMauro Carvalho Chehab2017-04-05 20:07:31 +0200
commitaa58fedb8c7b6cf2f05941d238495f9e2f29655c (patch)
treedf9ba8889eb163b68126878e641b28c2ace1715f /drivers/media/usb/gspca
parent[media] atmel-isc: fix off-by-one comparison and out of bounds read issue (diff)
downloadkernel-qcow2-linux-aa58fedb8c7b6cf2f05941d238495f9e2f29655c.tar.gz
kernel-qcow2-linux-aa58fedb8c7b6cf2f05941d238495f9e2f29655c.tar.xz
kernel-qcow2-linux-aa58fedb8c7b6cf2f05941d238495f9e2f29655c.zip
[media] gspca: konica: add missing endpoint sanity check
Make sure to check the number of endpoints to avoid accessing memory beyond the endpoint array should a device lack the expected endpoints. Note that, as far as I can tell, the gspca framework has already made sure there is at least one endpoint in the current alternate setting so there should be no risk for a NULL-pointer dereference here. Fixes: b517af722860 ("V4L/DVB: gspca_konica: New gspca subdriver for konica chipset using cams") 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 <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/gspca')
-rw-r--r--drivers/media/usb/gspca/konica.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
index 71f273377f83..31b2117e8f1d 100644
--- a/drivers/media/usb/gspca/konica.c
+++ b/drivers/media/usb/gspca/konica.c
@@ -184,6 +184,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
return -EIO;
}
+ if (alt->desc.bNumEndpoints < 2)
+ return -ENODEV;
+
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
n = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;