Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1165299pxu; Fri, 16 Oct 2020 05:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx86v3XQywhCC5lnjKI2MpTtUxq/unIpdzUpPnhs657i6M8ORHIWMIByH877pa8Keta7REK X-Received: by 2002:a17:906:5f96:: with SMTP id a22mr3480136eju.168.1602852049309; Fri, 16 Oct 2020 05:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602852049; cv=none; d=google.com; s=arc-20160816; b=GZgbhzW8ABt+VSVhN5RssFZtrXKb249koK5SOW8vc6ENYG0qaE2SOgOqRw2eyC9fCy chI6u7iZR9zeP+L5uroHrCvM7QbhSeHvsqkvYvrvQcdDFXGEtDsMzVwENXA/+AYmms5a fiGBKyBkD8nK9kAkDKA0NinDHAbFFX5F62A6utSrl158GqtVtdDxznf2pCaTtRZBVhqQ cgOP8y6lblcP9tL2VS+ekBozs/rD/Vxau9NOIFr2YTN95JAX5bj3vzpy4zHSL+P+Sp/C 5idNNh/UtiPjeynNoBXMjNSIWZyEuLbxoJ8K/kugH2H0oXNGPzHppPbSDQy9xlzhcTus 0yBQ== 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=x+/xuDubyehy8cK7HiUafhk+lJo57zqk2RODRRw4WhJgiyotLoh1tYijouPW6MNkNi hoZ1RdNSRMUFC+LoIZBdjRZWwu3Ha/skCMU9AeCjc5Ud+0HZss+VD1HwwVkYdME+sMcn GLWk8TX8fuQk744NX7y4K8G1UUbBe+NwkRXk7jSq/4Y1Xb1dEQd5nar12tV2JBkZJXSu 7yor4Eb/Cl4I1QPv8UGiZkSt+ysmmaUFpFhvrEu8MMCqpvnvjOFcl+o4UfTTpCiUIoRK V7VGv3PID6R01xsvjWEMag14We18IfDqmZYMbA+OPWURulDv2FiD0LIDyPuNlyIbAPja 4r6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D54KlsDu; 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 d2si1594502ejm.716.2020.10.16.05.40.27; Fri, 16 Oct 2020 05:40:49 -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=D54KlsDu; 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 S2406123AbgJPJPF (ORCPT + 99 others); Fri, 16 Oct 2020 05:15:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405211AbgJPJJe (ORCPT ); Fri, 16 Oct 2020 05:09:34 -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 1E43120878; Fri, 16 Oct 2020 09:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839373; bh=4PMp+jC2Cua2QgUNI4boZbV9Y0Y/jP3yD0u9iJv70Zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D54KlsDuZoHQ6YjZwd7qBFtPjFR69h8YXgBjkKjUcnlcePOpG47kX3GuA56anxp10 xRRSMYGsxqP1uLICJWEQJKddzzoZL+t8LDBT1goKB27kItq+3HLWXZ39VQmqMPqQTR TWlYckkR8nPSPV59HkjHfyNA/Uo4a08HRYjylAwg= 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.19 14/21] staging: comedi: check validity of wMaxPacketSize of usb endpoints found Date: Fri, 16 Oct 2020 11:07:33 +0200 Message-Id: <20201016090437.987989197@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.301376476@linuxfoundation.org> References: <20201016090437.301376476@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; }