Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1142636pxu; Fri, 16 Oct 2020 05:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh1zxomWgY01BVnZ29D58h4fUm4odB3l3fyH4CgteK34lYvWPaZymk9AwJpNSeeUDVAqUE X-Received: by 2002:a05:6402:6d8:: with SMTP id n24mr3527697edy.168.1602850106800; Fri, 16 Oct 2020 05:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602850106; cv=none; d=google.com; s=arc-20160816; b=JxduFnCqGeHTPQ0jZ2bm1J6KAFVJw9x1gCBLaV9uEzSn1mjT0dT+NtX8rDeAnoodas 9c1s0SWBorMa4OzB3XeysW4XInxZsZw6FUZZUfN46RNbeh7iuFBUX1rfGbDvXy8uCS6M mCdGa6aH4V0srzQFXdGf7SNXfXz5uuKJH5yHShGIKOFiv0OBdiK5cXKvAqyBtAgRetYr 3Y2PkS7/dJ4Q/LFwRZkUCSqwZQXNNT3q0/mFyG1SrrhHeVmga6VYcnpOwSuSB7NxsgDz VZzV6v3rxXFMUxGFPh4YCv2OqdaA6WdcgvByt6MZ9rAHSVfvoz6/k5aMTrC5Aps3Q+1e kjZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8SnJ++m5aAcMUWkhbRGTtfY/4DVl+f9Y6IOipkV/mkk=; b=W+wjWeV4Bf+/wYBYKlv0OLfHWAJlJJ245t1wpei2M0OqnVTZrCmb0IKSkdf0xst/Ey 7SbfRLNi+MFds0Qu18DXeRef2MGtYZo4mCtybdjOaxWn1e4hEI77ged1Ig/av+lj/4sS P8w6xhGrvhLPXEBcmbxvjvaGJMjzrWnJWOvo/LN0q1trbhb+9p3wuN98MHjhSe+cw1vM vwYLBXqoTi8KnNER9SsCwwLQMnhAMNbJqBH7w/DDKF58AaWAAbdG+BMHjzkBIEurE3nL ZCpiN/k/6Ul/YVzcVwPWtkJEqla8ATyMqWwsQfYlWaBhrQF6fJqyTHUHVHVopxK8+fWz w6JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uHwSoE93; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk22si1524248edb.258.2020.10.16.05.07.59; Fri, 16 Oct 2020 05:08:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uHwSoE93; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405533AbgJPJIl (ORCPT + 99 others); Fri, 16 Oct 2020 05:08:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394896AbgJPJHg (ORCPT ); Fri, 16 Oct 2020 05:07:36 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 29DA120848; Fri, 16 Oct 2020 09:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839255; bh=KcIEWczBuJ5XVoDH/sdmyOJrrZnoRvSFRt8CRA3yxyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uHwSoE93sWCE05g1YPAwdQFiuq+Ri1QQQ9b4yi5avCi/h4ykd7i6Vv8vX8iYo2SQd 5pctjbmaCpGae9hmCNsEwlFmNiNAuhPm1o9HrSzD3iODHL3mb7116Ors1GCbNXQ/pC GM1LnGETw1sHgUPZem2h1gbHesyujCCfpEgI+Eng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+009f546aa1370056b1c2@syzkaller.appspotmail.com, Anant Thazhemadam Subject: [PATCH 4.9 11/16] staging: comedi: check validity of wMaxPacketSize of usb endpoints found Date: Fri, 16 Oct 2020 11:07:15 +0200 Message-Id: <20201016090437.776010612@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.205626543@linuxfoundation.org> References: <20201016090437.205626543@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anant Thazhemadam commit e1f13c879a7c21bd207dc6242455e8e3a1e88b40 upstream. While finding usb endpoints in vmk80xx_find_usb_endpoints(), check if wMaxPacketSize = 0 for the endpoints found. Some devices have isochronous endpoints that have wMaxPacketSize = 0 (as required by the USB-2 spec). However, since this doesn't apply here, wMaxPacketSize = 0 can be considered to be invalid. Reported-by: syzbot+009f546aa1370056b1c2@syzkaller.appspotmail.com Tested-by: syzbot+009f546aa1370056b1c2@syzkaller.appspotmail.com Signed-off-by: Anant Thazhemadam Cc: stable Link: https://lore.kernel.org/r/20201010082933.5417-1-anant.thazhemadam@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/vmk80xx.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -676,6 +676,9 @@ static int vmk80xx_find_usb_endpoints(st if (!devpriv->ep_rx || !devpriv->ep_tx) return -ENODEV; + if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx)) + return -EINVAL; + return 0; }