Return-Path: Received: from mail-co1nam03on0118.outbound.protection.outlook.com ([104.47.40.118]:6048 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032206AbeCAP3B (ORCPT ); Thu, 1 Mar 2018 10:29:01 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Oliver Neukum , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [added to the 4.1 stable tree] [media] usbvision fix overflow of interfaces array Date: Thu, 1 Mar 2018 15:23:58 +0000 Message-ID: <20180301152116.1486-143-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Oliver Neukum This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 588afcc1c0e45358159090d95bf7b246fb67565f ] This fixes the crash reported in: http://seclists.org/bugtraq/2015/Oct/35 The interface number needs a sanity check. Signed-off-by: Oliver Neukum Cc: Vladis Dronov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/usbvision/usbvision-video.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/= usb/usbvision/usbvision-video.c index 3b3becc5718d..7b12710becac 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -1522,6 +1522,13 @@ static int usbvision_probe(struct usb_interface *int= f, printk(KERN_INFO "%s: %s found\n", __func__, usbvision_device_data[model].model_string); =20 + /* + * this is a security check. + * an exploit using an incorrect bInterfaceNumber is known + */ + if (ifnum >=3D USB_MAXINTERFACES || !dev->actconfig->interface[ifnum]) + return -ENODEV; + if (usbvision_device_data[model].interface >=3D 0) interface =3D &dev->actconfig->interface[usbvision_device_data[model].in= terface]->altsetting[0]; else if (ifnum < dev->actconfig->desc.bNumInterfaces) --=20 2.14.1