All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] uvcvideo: Prevent heap overflow in uvc driver
@ 2017-05-22 19:48 Guenter Roeck
  2017-06-28 14:36 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-05-22 19:48 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Robb Glasser, Guenter Roeck

From: Robb Glasser <rglasser@google.com>

The size of uvc_control_mapping is user controlled leading to a
potential heap overflow in the uvc driver. This adds a check to verify
the user provided size fits within the bounds of the defined buffer
size.

Signed-off-by: Robb Glasser <rglasser@google.com>
[groeck: cherry picked from
 https://source.codeaurora.org/quic/la/kernel/msm-3.10
 commit b7b99e55bc7770187913ed092990852ea52d7892;
 updated subject]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Fixes CVE-2017-0627.

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

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index c2ee6e39fd0c..252ab991396f 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1992,6 +1992,9 @@ int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
 	if (!found)
 		return -ENOENT;
 
+	if (ctrl->info.size < mapping->size)
+		return -EINVAL;
+
 	if (mutex_lock_interruptible(&chain->ctrl_mutex))
 		return -ERESTARTSYS;
 
-- 
2.7.4

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

end of thread, other threads:[~2017-06-28 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 19:48 [PATCH] [media] uvcvideo: Prevent heap overflow in uvc driver Guenter Roeck
2017-06-28 14:36 ` Guenter Roeck
2017-06-28 17:59   ` Laurent Pinchart
2017-06-28 18:18     ` Laurent Pinchart
2017-06-28 20:26       ` Guenter Roeck

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.