Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp736952pxb; Mon, 25 Oct 2021 17:48:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5GOm0UZOdhcGspEo3H99VCNJQwQfJPodkE0RbpZqgvAkQor8h5pdCI1O/YpQYHAtrrGzp X-Received: by 2002:a17:907:7ba6:: with SMTP id ne38mr26460054ejc.150.1635209292143; Mon, 25 Oct 2021 17:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635209292; cv=none; d=google.com; s=arc-20160816; b=b7UVSB4S+THZJ3Cvg0hb5WE5BBvZN2ma7F1cdcWoiA4wEK1XtQdhW49BWJTuckoUuM Fmv5JGvW7gimUVH56Wd5VXFYmKw/HyhTnEZmmeUUYI0qJn2Xld5h65u2h4nCN4ZAgQMy N3mvzWMj/nyGDdpaxEcY8Un4TtF09spGZxnHQ8VRa4xfUUZ45FDMnVwdevrFsFykLg5L gKasD/YKHn9Hpz3jZgMIa5jbvxQENNZznuQEMDovk7teoInMUqWeALy/MWErG92pBHvJ jNRqomhunLSdW+b8VJa4DySLQ+pNstKFCUMtNsIII3YKcBS6VOE7V8Vezfrf6F23q2pc gCzQ== 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=xLXIUrPY8vZg8BKTV7GzU0FVO79GRsBEhuzQMC9V78kyC9evQuqyW0OBYMceJmN7uS dfm7ULaqltYA6xRtiwIOcqKEkxjsKryONP2TlR0gV0/VXfJ41cywqFzx/ZNyTovFMJBH bQEGAKF+sT+96VMq6l+GX03kXj6lr5p0XvTpWRSvrJQEdLggL7+1sk3PI8UwHRfGyUVH qfaOchNgpfu/W+ADmOaeQaS26Jna5htq9MJ8FJECGSlHhnNDqMTFgPMnYUXIOvdPlsNP BUEBJCnxe5HUhe4ajDvWPrtdOkIPkF4gRBovZw/kormhzjq3XJOue9GzvQYm71NwLhYd VWWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r+YeIHPM; 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 ht15si13749163ejc.49.2021.10.25.17.47.49; Mon, 25 Oct 2021 17:48:12 -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=r+YeIHPM; 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 S240327AbhJYUAR (ORCPT + 99 others); Mon, 25 Oct 2021 16:00:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:42076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238062AbhJYTz7 (ORCPT ); Mon, 25 Oct 2021 15:55:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7776B611C6; Mon, 25 Oct 2021 19:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635191187; bh=m4vu12vnujXJGiY9YknzWfRdnNvdxK4B2TtJrvSzznY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+YeIHPM/EcvnQho1fF3vDhkB7h5m4EzYhPLSIvyeevhAk+ErAazg10d2qDNC8Idl ydKWq5F/5BvDxugaaDs3CIH0M2N9P3oOc1JMxQFM/47o4rPiM9xkvQjfaXz7mjLkqp EtF/vFvi1xvlYFVagYazCwxMER+1gakqscxxQf/0= 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.14 165/169] usbnet: sanity check for maxpacket Date: Mon, 25 Oct 2021 21:15:46 +0200 Message-Id: <20211025191038.360463849@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025191017.756020307@linuxfoundation.org> References: <20211025191017.756020307@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))