Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1149983pxu; Fri, 16 Oct 2020 05:18:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVkjiZMe+raFNJKHO3LWpEJj+1v4HK/emec7Bd6B08HsyhmGo9e8I2WlTyaEbmgCrwaetU X-Received: by 2002:a17:906:6545:: with SMTP id u5mr3413841ejn.346.1602850706805; Fri, 16 Oct 2020 05:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602850706; cv=none; d=google.com; s=arc-20160816; b=KLUozhB2H/7B2kXB6dzAaA/pyyvDfk+MCGzjUj3mOtLR3QF1K1tXd0SES9S1G/EbVa P4Y1nBLjTJRud09WTL1OTEtEp95xOXwpXYxZGkR/uTnQoT9F7EWMRgI6jRSHiSbKOq0O zLw3ZygdkA8cx+bPSVG48rCQwYOrcPA2uF71slpDb8ZUuxTMSsNHEP1xTIMp530EydQ0 EorTUuXHBgJGAdT0kFAa/sMGmp1y9LQ8EW9tpgtrMPB1QNOZ9Y4CPiOkNpjVRvI+q5lj MTzZPTvDACy14tVdZpbwOEU4b5t+2rgangD3WkYZNWisl9GQoc0zImuKOhB4cEubrz9b BUdg== 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=SWs2BzSjyGFSDU2MBTuhRt3d5ziBgImM72XRTlI9Y1Y=; b=JaMzid1RBcemZs9UK7Qd7xuqF/7lrpP0jHb/ranINEgIqSjm7sDfaR4HZuglIAEZGf JJFLHIGSSMT7hbT3x5M7BVrgqlZx7/8Bjauf1hqCORbnIll3A9DlbEa/GNaRWMffstsP wnnRUQYz89QRtQDnJUtiGrd6MrCZgSvu/FB9/fND8ptdibi77ujzrirkcH9UZFPhHZ9J h8QE4EXhAR1JvvrkCEZdg/YNQ8H9xAx3bxcbcBeS3efT0ceLHMrncnr5BLqbuisGIGX8 hnFwNyO6QTJ4KjU8Tcc3I4aUmXroD5VQmQbxZCH0Jo821x/ZRLL/yt7zbJSK6qUiTBIN aUpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lPANHb+m; 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 cm23si1525464edb.19.2020.10.16.05.18.03; Fri, 16 Oct 2020 05:18: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=lPANHb+m; 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 S2405824AbgJPJLU (ORCPT + 99 others); Fri, 16 Oct 2020 05:11:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:40354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405759AbgJPJK5 (ORCPT ); Fri, 16 Oct 2020 05:10:57 -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 695DB20EDD; Fri, 16 Oct 2020 09:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839456; bh=4PMp+jC2Cua2QgUNI4boZbV9Y0Y/jP3yD0u9iJv70Zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPANHb+myNOCUSLQDxIN2VDU9q6owdzTLkjvWc8FPzwq/0KJfYdIdZHso5AiQKyI5 BBc1NZBViXls9/oXTl9ifptMntrF3zfBiLAEaT7NlpC9n4mxxRIXhPnCmSw/AhgpXL vjGF3aPnBe43BoB1TAIIkA2qTARLuXQdPYDpE8Es= 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 5.8 10/14] staging: comedi: check validity of wMaxPacketSize of usb endpoints found Date: Fri, 16 Oct 2020 11:07:55 +0200 Message-Id: <20201016090437.665407940@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.153175229@linuxfoundation.org> References: <20201016090437.153175229@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 @@ -667,6 +667,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; }