Skip to content

Commit fc9753a

Browse files
jhovoldgregkh
authored andcommitted
gspca: konica: add missing endpoint sanity check
commit aa58fedb8c7b6cf2f05941d238495f9e2f29655c upstream. 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: b517af7 ("V4L/DVB: gspca_konica: New gspca subdriver for konica chipset using cams") 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 04f5224 commit fc9753a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/media/usb/gspca/konica.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
188188
return -EIO;
189189
}
190190

191+
if (alt->desc.bNumEndpoints < 2)
192+
return -ENODEV;
193+
191194
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
192195

193196
n = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;

0 commit comments

Comments
 (0)