From: Elena Reshetova Date: Thu, 4 Jan 2018 09:25:32 +0000 (-0800) Subject: uvcvideo: prevent speculative execution X-Git-Tag: v4.1.12-124.31.3~1381 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dde52918b1f284e5da3ea3907d730bb819f80216;p=users%2Fjedix%2Flinux-maple.git uvcvideo: prevent speculative execution Since the index value in function uvc_ioctl_enum_input() seems to be controllable by userspace and later on conditionally (upon bound check) used to resolve selector->baSourceID, insert an observable speculation barrier before its usage. This should prevent observable speculation on that branch and avoid kernel memory leak. Signed-off-by: Elena Reshetova Orabug: 27340445 CVE: CVE-2017-5753 Signed-off-by: Chuck Anderson Reviewed-by: John Haxby Signed-off-by: Kirtikar Kashyap --- diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index c4b1ac6750d8..adad6ffe2ec1 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -802,6 +802,7 @@ static int uvc_ioctl_enum_input(struct file *file, void *fh, } pin = iterm->id; } else if (index < selector->bNrInPins) { + osb(); pin = selector->baSourceID[index]; list_for_each_entry(iterm, &chain->entities, chain) { if (!UVC_ENTITY_IS_ITERM(iterm))