Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp98384ybp; Thu, 3 Oct 2019 10:43:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVO5/J0MvaZUcWrFdjTY+d3T9uHvG0WdzdaSIpYFLn3GJYeIxzE9rPSM2/8v9uiYjWBybg X-Received: by 2002:a17:906:4b07:: with SMTP id y7mr8652549eju.126.1570124622411; Thu, 03 Oct 2019 10:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570124622; cv=none; d=google.com; s=arc-20160816; b=DEQzRadjVjluiI6dEPrUVaiEL8I162lpbfWUhO4CJNTQHycOi6FZCh0EcFDu/d8YrT 3D9ZOT8isa/VIhKBswlzJful2WFQGO3ATb1fBnqPBsSAN+S97n3tJRn8oZZZGuLGZhrW jq/snE7xTu/3EC9MQIxju8F13UnwHnvph7IoLXYSn0zwum9FiPyh2+rR7ltI+QGi1bpP yto4YFPEV/7lNRVPCEjHuZQDEdVaVvmUsZaHxQhkWn+cbbUi0nxiDIuHkihcOxZam9k6 XtfdlO+FTEPw7XVIg2Wg+wiyWCmTLWDMaWJWpR8lCa5e3gHnm8C/qZvOsgtEICTiYVCy 4lEg== 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=c87vxf2BTureOAsHAZO0Q1F351skRP6y9c2eRkvBwRo=; b=RUiEPLHUIoPZ9sPRrSCj155Vw3K3TLayfRk8QQzq4acG1aM6s58BIldm1ivwvvLGBX N11MG3LWQ4myvkdhMNmkGg7BQ7EwWT3SXMHgvfoGojLBUoVNmW5OdRMLdsj9GK25z0ul wjFWwKiZOw7ezVUivHcARnTWNAD3bK8lodaB5kJif9Bt36MyPgJ1dCA7kjtQEHLWSYQ8 v+5Zw/YaTDyJc/YCSkSPoahDSRHQd9bEeD228YV4m8EJHctlnz1j6cjEXcjuK+VrK4lo s7p5d0FLzF7UZI3/g6tMe82tyt2yp2BXa2UwanPb2vImI64V845rbobCUBTsvyD07he9 Vu2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rK94rNr2; 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 h15si2062107eda.284.2019.10.03.10.43.18; Thu, 03 Oct 2019 10:43:42 -0700 (PDT) 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=rK94rNr2; 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 S2387694AbfJCQQe (ORCPT + 99 others); Thu, 3 Oct 2019 12:16:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388994AbfJCQQ1 (ORCPT ); Thu, 3 Oct 2019 12:16:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 A10D220865; Thu, 3 Oct 2019 16:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119387; bh=A7bB2lRTeqg19DskxmH6x0oHCi3rj0FsE/t+ZNh3yVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rK94rNr2XlRZYWRTIEyywnJQiDe32gxmuqN/oVynTcHeP8Vtr6Esocx8NcKJvn5DQ 6/RZWCu+sxlxNw1sxKSEBjwXOpBDKy5Wv2DpU2znaoMeNOn6jmvXQvQpeXezIeeLpQ fRTtds5E5C6PreQZSkI7peL3IZ9Yhbg9O2/vBg7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+01a77b82edaa374068e1@syzkaller.appspotmail.com, Oliver Neukum , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 047/211] media: iguanair: add sanity checks Date: Thu, 3 Oct 2019 17:51:53 +0200 Message-Id: <20191003154458.734574947@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Oliver Neukum [ Upstream commit ab1cbdf159beba7395a13ab70bc71180929ca064 ] The driver needs to check the endpoint types, too, as opposed to the number of endpoints. This also requires moving the check earlier. Reported-by: syzbot+01a77b82edaa374068e1@syzkaller.appspotmail.com Signed-off-by: Oliver Neukum Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/rc/iguanair.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 7daac8bab83b0..6f3030b2054d0 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c @@ -424,6 +424,10 @@ static int iguanair_probe(struct usb_interface *intf, int ret, pipein, pipeout; struct usb_host_interface *idesc; + idesc = intf->altsetting; + if (idesc->desc.bNumEndpoints < 2) + return -ENODEV; + ir = kzalloc(sizeof(*ir), GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !rc) { @@ -438,18 +442,13 @@ static int iguanair_probe(struct usb_interface *intf, ir->urb_in = usb_alloc_urb(0, GFP_KERNEL); ir->urb_out = usb_alloc_urb(0, GFP_KERNEL); - if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out) { + if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out || + !usb_endpoint_is_int_in(&idesc->endpoint[0].desc) || + !usb_endpoint_is_int_out(&idesc->endpoint[1].desc)) { ret = -ENOMEM; goto out; } - idesc = intf->altsetting; - - if (idesc->desc.bNumEndpoints < 2) { - ret = -ENODEV; - goto out; - } - ir->rc = rc; ir->dev = &intf->dev; ir->udev = udev; -- 2.20.1