Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp658221pxb; Mon, 25 Oct 2021 16:02:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE1rhkyWrgXRljt5D1lfclpfsEUMZmR4pnu+oCfC2aq43iZ1oDyPoQRi0Qq765atgKblAc X-Received: by 2002:a50:bf05:: with SMTP id f5mr30833304edk.156.1635202954058; Mon, 25 Oct 2021 16:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635202954; cv=none; d=google.com; s=arc-20160816; b=JWKanwiUt8J6tSwafzwQluoKSH4/tcDRN9q47xVOAfNcfOrmyz+1ODlqova2EiB2aL P+V8FfDWlOcAkbsZYT3B+iK7Noi6maGI9cjDne/26sbFm9cz2r8mP+nxry85MF1HxKLG bZ4yS70YBfxgSBqJibTqH3znpAlLUMK+frd7TZgPPRBArYhksYr4g5Cf6++zm2cTCQxO YITfau9+voJJq7w+g9mrQmmaogtUtr+SqNtke8W2040QI+UjaEKGywBqudlFvjcRddHP PR/h/nqmHCHFOlI7mZunPVOnwXQ9YL+BUYboX2bMvUSFxAGM4NkY4iTcz94KKgu2LK0H 8BLA== 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=y+0V/hkEhIngPUgpIyFKsX7mnFW+6HceEQbnTvoAL2A=; b=miVwI0Ri1BcmKhw36qrdvLt0ZFa77Ip/ZDp5z0fcU0E9jsnKLbCKx1ZCRaqO35cSEJ lJvnpBlr8tM7cR/kGDAZqx8uMPDdkykns5lmuZESi1lVxwNWTQkXtlbnmtMoYjZjEM97 HcKCM/jvmIrNAFduDnkblC0uou8gqw7YiBLFxGvJekV9sW+mEfnkoBQv7c6jxNmo0Yhi jD++Bpdlzhvek8yp01Xxzf1EOOR71hXHmVDLfKcKwV+kfNG+rJKRiEq8FaV8g+79Agvg hkCUF8srODv5AQQq2JSgM8hqevLFZfSBKW0mUqoTer4DgZxLdb3ein6MJuudHwgooKem GTtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mlnQXSVC; 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=pass (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 z12si36353996edd.70.2021.10.25.16.02.10; Mon, 25 Oct 2021 16:02:34 -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=@linuxfoundation.org header.s=korg header.b=mlnQXSVC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234683AbhJYTUf (ORCPT + 99 others); Mon, 25 Oct 2021 15:20:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:37694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234697AbhJYTTl (ORCPT ); Mon, 25 Oct 2021 15:19:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF5ED610A5; Mon, 25 Oct 2021 19:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189438; bh=5+O5luxEq+ZJHTsBpfKr8ocub3IP1PsSW3FLEVO+9B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlnQXSVCMY8x0eaD8T5MKeAMBgnU8oc3k4dTbO/wQoEAIWJOqMwtMWTgPI0ZK2Gvp Veip8jBvcFx9XPIx/2iuwPsUWDZAIPAD/g9uwy+R6nRzBN77eq1N+QD8eMhUJK2Ih8 qwF57Wj/ISZyLRIh2kh/eLeiPXoICN27hneQlHv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , syzbot+76bb1d34ffa0adc03baa@syzkaller.appspotmail.com, Johan Hovold , Jakub Kicinski Subject: [PATCH 4.4 41/44] usbnet: sanity check for maxpacket Date: Mon, 25 Oct 2021 21:14:22 +0200 Message-Id: <20211025190936.928156150@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190928.054676643@linuxfoundation.org> References: <20211025190928.054676643@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: Oliver Neukum commit 397430b50a363d8b7bdda00522123f82df6adc5e upstream. maxpacket of 0 makes no sense and oopses as we need to divide by it. Give up. V2: fixed typo in log and stylistic issues Signed-off-by: Oliver Neukum Reported-by: syzbot+76bb1d34ffa0adc03baa@syzkaller.appspotmail.com Reviewed-by: Johan Hovold Link: https://lore.kernel.org/r/20211021122944.21816-1-oneukum@suse.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/usbnet.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1730,6 +1730,10 @@ usbnet_probe (struct usb_interface *udev if (!dev->rx_urb_size) dev->rx_urb_size = dev->hard_mtu; dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); + if (dev->maxpacket == 0) { + /* that is a broken device */ + goto out4; + } /* let userspace know we have a random address */ if (ether_addr_equal(net->dev_addr, node_id))