Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp643741pxb; Mon, 25 Oct 2021 15:42:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNwjcI5+q1OU3Ih5h2xba0rQ5Y2Jysf7f4PSb4qoxvFFUiEmN3z0CMECJCiEkyhxSOH6KN X-Received: by 2002:a63:b203:: with SMTP id x3mr16062841pge.239.1635201724613; Mon, 25 Oct 2021 15:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635201724; cv=none; d=google.com; s=arc-20160816; b=c6UelRQ/VztGzj3ch8lUsLVQULK/WR2iDjCTKH4PMGyTHuhFqWQov0tyFjx5jZlgN1 GO5exuQG0I9d9/pl5P69vmqI+MCouVUmmFPfkfkJEFmobJbVqYCBdQnQA4aDsMImPpww b+PL+Jw+RrUxbhMYYa7gk2prd0v8vOzocSjgjVXKepECuvi9TVlKIIYkBISD0tSfaFko ZldzcpSUen7NjqbtSX6G91hm9E+E+VqlQi9/K2RckhmfRxcOAfV0fqq9bHlh45qSLLzr pnuUlfzNFt2pakssATmj2MDAE+dvoD17rQ5UFoiija8CEnBTEENxZ3cA8EIImV2MsWuF calQ== 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=WFFb2AZabGEzgbRk6ixkI4AmWx8nqE8vcv2w08QCT9w=; b=M2+AlPaz8UuRxTYkewGAPmu7e3oY9c8lVrqr0MVss99NOo4F4UKpRwKCNlC1IL/udy X+GUlQzlr0efR/6uKQ3x44f9q3l8+OLIvDm/+ISEirAJVNUE/0l6NQ+yG3LawqfhmXD0 14/IC61GJtpt2v0Y6LtgU1zZat6mHctaxSAK9L8GV2JSzeoQVQX2MdvhX8JjQV+C8mfI spwhZ09eC5SKBIrJaYLPrxiGH5GqO6P0XEM2sN263YsCuzTNpgQ71AoxmVBVCFzh9v/h +/D3GWxEKjwy596Bj9zx6KRrwBMPNgtH5AUsBuM4rCdlLJ/pFZcZyq0sWnyhqmhGQIXI jHBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PE7cFweJ; 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 w190si8449368pgd.453.2021.10.25.15.41.51; Mon, 25 Oct 2021 15:42:04 -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=PE7cFweJ; 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 S234555AbhJYT1o (ORCPT + 99 others); Mon, 25 Oct 2021 15:27:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:43150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235114AbhJYTZl (ORCPT ); Mon, 25 Oct 2021 15:25:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B462610D2; Mon, 25 Oct 2021 19:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189770; bh=m4vu12vnujXJGiY9YknzWfRdnNvdxK4B2TtJrvSzznY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PE7cFweJ8X/+eYzMBa5Olls+dS+ena/MeOdpBxE9nuCbn3A0a7gBimOxyAV8ewTHg b7TfjbjdyJv40nmUaNUST0GDvrRrZ1xxdBD+cKPRzQdHGneSP/YjxmlKX+NohReA7/ RNUIFDWc1NmcelLbDrVfBZhRA2+frib0uEaWLPjI= 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.14 27/30] usbnet: sanity check for maxpacket Date: Mon, 25 Oct 2021 21:14:47 +0200 Message-Id: <20211025190928.836300328@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190922.089277904@linuxfoundation.org> References: <20211025190922.089277904@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 @@ -1788,6 +1788,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))