Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp647612pxb; Mon, 25 Oct 2021 15:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEWe8vdpmTHSvZMgsjnZY5YFI00CH8EJ3gQuphLnaDoNwpIm5QljelGA4beQpDHA9h/pl/ X-Received: by 2002:a17:90b:4b89:: with SMTP id lr9mr24313042pjb.11.1635202073841; Mon, 25 Oct 2021 15:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635202073; cv=none; d=google.com; s=arc-20160816; b=Vmh6D1AbZrPFhKYgzVpYw58g6NrEdxl2Gh5md37b2a8iajV62g81/GjDpszFTt98Sy z68nPrvZM9dS85IzPF2Mbm0HLQxUsrmOhr+k5h1IsJ1p59EQ+F962FWtwi9rkX0XWANR jVNLjkNwrZK8jvLTyDE6bl3ifxaFJvryCV7Sd2ZXtOJ+HfeYk5rxAd1Emj8h3I3cgccA +peimFyhdrzXXmR3ZD5y21oYedABBkDrtcAlpxG8vDbYI2VeLY4/PDjqHCIz+Ip6UzA/ zJqrI7z4k246U9IkuZ45EOBm8DnSt2XLO9PWIurYjviXa0njqfo07OFH91YhfLY3Ufqi 5WIQ== 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=cq61kojRD5JXm2ieKWg9Fvj+CcK6vqgsweAFfJiyowU=; b=vzrJYwE7fpC04z0spom5O+VQFYNTiMO6sS6Y4f0vZtP8b4BbLZ2L/4J0UEet8FrUTP 6EhE57i6JxyO7q7nNTU0+3v2yyvVBpU9sQGvJ8O8qlvV5pBMz1cT7YaQVaKvUiu7Vz1A XEOuSklb04s4Mytv6dxOcPq2qckxW5GGYSc/PTp8OO/TxdmY9gD5BdBqHjCjsBb3GXQt j/fwneq5KdMV92IJnc9fist3wv/ttfi1GYloToGxs//0UdVIby/UxLiAjQsj9IDN1jxR Ux9TfFwZuYvMwbK40A5djWL4eJYqSgejAt/NfifbJi/B97DR10gul0bv5Xolx8C6VmqF JaQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eiT27EDH; 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 k20si23505169pji.176.2021.10.25.15.47.41; Mon, 25 Oct 2021 15:47:53 -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=eiT27EDH; 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 S237125AbhJYTiu (ORCPT + 99 others); Mon, 25 Oct 2021 15:38:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:48432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236122AbhJYTdg (ORCPT ); Mon, 25 Oct 2021 15:33:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4420861167; Mon, 25 Oct 2021 19:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190145; bh=DPZRoibiMdTyqf3nZR0mvk1QD6AlHTeK37w5mGaUqZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eiT27EDHGf/9RSoYoe5ZeFlC+3XD20SlZNaGkuWb7vBZwbFbaBhy9nm9Kb+qR1492 1FgPa3pkGJX66yI9zVfVnFxs02fjvZ4kX3Falhy8scHRtHBrOLr7Ydi+NSv6Lg6Dy/ g8BwARNcfYoU1mwZ5VC8oE7VePfdnRFRam8JADb0= 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 5.4 54/58] usbnet: sanity check for maxpacket Date: Mon, 25 Oct 2021 21:15:11 +0200 Message-Id: <20211025190946.651041400@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190937.555108060@linuxfoundation.org> References: <20211025190937.555108060@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 @@ -1773,6 +1773,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))