All of lore.kernel.org
 help / color / mirror / Atom feed
* [git:media_tree/master] [media] gspca: konica: add missing endpoint sanity check
@ 2017-04-05 18:07 Mauro Carvalho Chehab
  2017-04-10  8:18 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2017-04-05 18:07 UTC (permalink / raw)
  To: linuxtv-commits; +Cc: Hans de Goede, Hans Verkuil, stable, Johan Hovold

This is an automatic generated email to let you know that the following patch were queued:

Subject: [media] gspca: konica: add missing endpoint sanity check
Author:  Johan Hovold <johan@kernel.org>
Date:    Mon Mar 13 09:53:59 2017 -0300

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>

 drivers/media/usb/gspca/konica.c | 3 +++
 1 file changed, 3 insertions(+)

---

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-10  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 18:07 [git:media_tree/master] [media] gspca: konica: add missing endpoint sanity check Mauro Carvalho Chehab
2017-04-10  8:18 ` Johan Hovold
2017-04-10  8:43   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.