Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2816156pxb; Mon, 1 Nov 2021 02:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfNc/4i8pw7HVsjEuYAegxoHNch53aOtMTzJHzJ6vg++/rtnLWrlFVk+CMrF4cMq1YBMDr X-Received: by 2002:a05:6e02:15cb:: with SMTP id q11mr19440780ilu.180.1635758570400; Mon, 01 Nov 2021 02:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635758570; cv=none; d=google.com; s=arc-20160816; b=xGbTy6I2XAind94EdUmddsWcBhNRxPb/5k2dsoNCA1R5g+oQ/1/GXhBtrPl9B8wPpa /yWPtu34+iibEgNj1N2WdpTFMNyO3oBBwsNsYk2jmdyx6J2dAfF3fbd/fMm7GDLo+pxa c44jmC3eE64691pu9AbLI4IbstI2Ap0lhnRcBc4Qv3LZjy/5a1eNWI6XCac43AUxwooa 2VbUi3ZstbvPSfAYZbdf1wMmhG6q4i2b4MFpzjFtfU+zmPa07dMlapNy0zO88JgNiQk0 VN1JUMh3dA2ZAbLvZe/QzcD2cu8MS+NyJehwNYG0KZBNX7T+LpmaaHABSzVUZMEakIFN KiBA== 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=a0BZDU64SaNRwdJrUpADSqSPKRWhsE4h/GWhkyBSTmI=; b=P1DIJIkzD8rk43zCjALxJ7Jp49/bmqkoVcRJHxxyemjLYWIQ8aeYU8G8yYyZTPz3gC 9pmLDObWgpyo7KBGfh38p5ujf/JR9EGXhSR9nhLRUyBNEXMMEM9jYcA66yEw5kEYZCah 0+8isRfIs1Nfcc60sRQf1dqMhG12FPUzaNx+Fq1R58pvu12U8V2670Fc1rjoToT5jVOq B4ioNm4xu9vgRWbDkHR0Dc0D3rmfXlo2TycDpgeaK9VXJ5XLIx2cNtpkPOicGoYU2FeT EBLAJSEcxND5MBFC0PQaS3zcsVUfRw4u2AxFH6+NAqteIbzVHqV0ICN10TwZzGY9hKJu WiAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gMOAlrtU; 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 u9si13988754ill.20.2021.11.01.02.22.38; Mon, 01 Nov 2021 02:22:50 -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=gMOAlrtU; 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 S232582AbhKAJX7 (ORCPT + 99 others); Mon, 1 Nov 2021 05:23:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:59012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbhKAJWi (ORCPT ); Mon, 1 Nov 2021 05:22:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 174286117A; Mon, 1 Nov 2021 09:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758392; bh=RsDMZW4n7+Z30k1OBfySXl2xmRMbFiWRHcUn4mW6JWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMOAlrtU283U/DN7H64Hr0hIh4zqv0+w9qNNq+h+n5CYAsRWKKQ3G+etjUlCgODpv Fo/TE35tT91yZzpuTfNZPq4PFjVgXwctBPmfuv4uqClW12SSS/J2Z3qKmbos+Yr/au PbBMo6btAtpsbwCCVbCg5Tm1CTt+FCGIo2P+PUjE= 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.9 06/20] usbnet: sanity check for maxpacket Date: Mon, 1 Nov 2021 10:17:15 +0100 Message-Id: <20211101082445.557168731@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082444.133899096@linuxfoundation.org> References: <20211101082444.133899096@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 @@ -1740,6 +1740,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))