Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp49370imu; Thu, 8 Nov 2018 14:33:59 -0800 (PST) X-Google-Smtp-Source: AJdET5c+Bc+tz8cWU23aT+zrvmIUH56L8ArFFPbtcB8qaqVzG7gHX3AdLV9nBG+OmHjxFRTl+fcm X-Received: by 2002:a63:f047:: with SMTP id s7mr5265630pgj.441.1541716439197; Thu, 08 Nov 2018 14:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716439; cv=none; d=google.com; s=arc-20160816; b=fY+i3yTsQQLPdilkFYx+kOHRAfxiAS8dpfV30xbuoPS+bvqy8rc7YeSO7UghGy167L X19Wk17S3KNFRyBbak3PF03g4u35ZL3LY7gbFqRe2jq+zf23g6mk6bLtx8/BCTw1XCes qOduW02KknsmcZQHrpv6BdEbEQbv/OTxW/W0w/sQ2WHfy2nK5JYkE9NmMgZmSZ+wXi9I KrvRx75vvY2neRYY66Dkhy3k4BQQMS/s8DGv11wBlrVqwD3vKeG5BdEMPBPX53QlO8oA HvVrExbj4SeI+c13oiTusI3VivBq5Q1N0YJEspgdB4mF7J77kn8fls1VyWcre0IlNL/E TRfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/zsujmS+u141cjf1RIfozPhAcCfw7wghNbhi5cC2EHM=; b=fUbuzp7Nfq8LHW4yTw3slB3mdK67xFGS2Ca/4KCaGnvIn+TV5TpPXA5FgA4/pv0yaT T1qCmNMjJyaduSypcVufpmlgf0ai0G4oY050/yveIoSDptRhnHS5oY4RDOKlU54Yo3MX A86MdpAuAnV6H5/JT+aWZrYW24JujnPdsi/da5MCaj18IOuZkWhkwjCtR7cmGKomzDmb B7ARujgdF+KMBGzpedz0bK/A9HoBHPzsDglUL0HMq6yy6sMlvt7Yf1BrlQLDvvfbYNic 8peUoWitN/kjoor6mPTvQNIHBs4LcWSzgB5sjph5geeQs1N6xe+xnWqNSgOxEtVsm+dS OUog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U6mNW75p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si4684636pgh.385.2018.11.08.14.33.43; Thu, 08 Nov 2018 14:33:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U6mNW75p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729707AbeKIIJs (ORCPT + 99 others); Fri, 9 Nov 2018 03:09:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:56444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729625AbeKIHhp (ORCPT ); Fri, 9 Nov 2018 02:37:45 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 630EE2146D; Thu, 8 Nov 2018 22:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714417; bh=0BpoAWH5QQ6lybM2pJ3Tw7jjLe6Zp8Fl/jEBUHeLnmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6mNW75pvPfgn1lwNkUtgVnh9eAM8xFS/eHPD7fAk2Jgg3uzh8H0Mv/PMnLA31ibo TClLYbK70owfbDUAZVfKrY5gO6UMCDPGqF2BXpaXrmVAjtI+Zk4/Tm1Ij1scu5mkf9 Xy7t25F0l/ShJ9cyTPykYFNkqPEd55GOjt6zoPZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladis Dronov , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.4 040/114] [media] usbvision: revert commit 588afcc1 Date: Thu, 8 Nov 2018 13:50:55 -0800 Message-Id: <20181108215104.742216131@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d5468d7afaa9c9e961e150f0455a14a9f4872a98 ] Commit 588afcc1c0e4 ("[media] usbvision fix overflow of interfaces array")' should be reverted, because: * "!dev->actconfig->interface[ifnum]" won't catch a case where the value is not NULL but some garbage. This way the system may crash later with GPF. * "(ifnum >= USB_MAXINTERFACES)" does not cover all the error conditions. "ifnum" should be compared to "dev->actconfig-> desc.bNumInterfaces", i.e. compared to the number of "struct usb_interface" kzalloc()-ed, not to USB_MAXINTERFACES. * There is a "struct usb_device" leak in this error path, as there is usb_get_dev(), but no usb_put_dev() on this path. * There is a bug of the same type several lines below with number of endpoints. The code is accessing hard-coded second endpoint ("interface->endpoint[1].desc") which may not exist. It would be great to handle this in the same patch too. * All the concerns above are resolved by already-accepted commit fa52bd50 ("[media] usbvision: fix crash on detecting device with invalid configuration") * Mailing list message: http://www.spinics.net/lists/linux-media/msg94832.html Signed-off-by: Vladis Dronov Signed-off-by: Hans Verkuil Cc: # for v4.5 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/usbvision/usbvision-video.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index cafc34938a79..91d709efef7a 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -1461,13 +1461,6 @@ static int usbvision_probe(struct usb_interface *intf, printk(KERN_INFO "%s: %s found\n", __func__, usbvision_device_data[model].model_string); - /* - * this is a security check. - * an exploit using an incorrect bInterfaceNumber is known - */ - if (ifnum >= USB_MAXINTERFACES || !dev->actconfig->interface[ifnum]) - return -ENODEV; - if (usbvision_device_data[model].interface >= 0) interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0]; else if (ifnum < dev->actconfig->desc.bNumInterfaces) -- 2.17.1