Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1336413pxb; Tue, 26 Oct 2021 07:14:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4pe5v0e+dEyzbNbpZp8jxmcVio11215NcoB3XnsPJwVyYb1UeLt91Y1uMXfOLxv13zfKC X-Received: by 2002:a17:902:f686:b0:140:3913:8342 with SMTP id l6-20020a170902f68600b0014039138342mr18323085plg.43.1635257692186; Tue, 26 Oct 2021 07:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635257692; cv=none; d=google.com; s=arc-20160816; b=WgyVQ5PIvIs9u9evK/NaY6aAdylfpam0NpJ7iWuL3UWUI9RamvYlElfImLjl3AVI9+ CT8lNVpoPhnr02ysePMJAUqbEsHQsnsXIYdLwO12buzHHlUZYvEPOM5RNpNHwd1QmTYq 2LEwBQNcOL6Q47WfrNCcVXLAXMED47sUmLFfHRpRr86dpty6DemSYuOXe43m+3tw6klQ t2Yip7lU91PHjjVoCkxFRIQz5aOxk95hzRr9KneKkOGgcbiLgph26UAjJn/8O/jxYyKm tYgndNh2OUi/ifEkinyem7RDlDw3iuFg/bGAcmx5N3gpzPz66gLWP+KMUjmgq3wT+IAZ Khpw== 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 :message-id:date:subject:cc:to:from; bh=SrbNdfI7b5A8YJffovmWQaU/Z8hPG/8Tt4M0/49qkQQ=; b=r3+v0f1vX8bh8NsYFq43bN0UsHlaFzyw/sdYRePx6dj4CjMyuN8mrkUbhzUDszypcz W2BW1JZ17H6b8C4bW3NbkG2Ym/hhWl9qeUBmJ4J81JuY6E9J3N2DrnpUyumo3rgNV9v7 /4YIuV/Ek4tIStEfygrOxprApaj6qij5kQKQldlHkLR6W5MCvPaJ7aWhu6aQVrCo2XF+ VUoFNzz91OY2B69L4Q8jS2yo/uv0kpOyaIGxvjkV1NJmQiDYuarGba/9STD5YGFt4ZkE IgBsEe9+FIqh4ykb8aQ2U9SmpjUK8c2OuS7LXWcI1MAV/yXgIxA3VOdDIovYLJsVqAXG cnKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si5148435plr.376.2021.10.26.07.14.38; Tue, 26 Oct 2021 07:14:52 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235370AbhJZLJz (ORCPT + 99 others); Tue, 26 Oct 2021 07:09:55 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:29938 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232091AbhJZLJy (ORCPT ); Tue, 26 Oct 2021 07:09:54 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Hdpnk2nmFzbnPy; Tue, 26 Oct 2021 19:02:50 +0800 (CST) Received: from kwepemm600001.china.huawei.com (7.193.23.3) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 26 Oct 2021 19:07:27 +0800 Received: from huawei.com (10.175.104.82) by kwepemm600001.china.huawei.com (7.193.23.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 26 Oct 2021 19:07:27 +0800 From: Wang Hai To: , , , CC: , , Subject: [PATCH net] usbnet: fix error return code in usbnet_probe() Date: Tue, 26 Oct 2021 19:25:26 +0800 Message-ID: <20211026112526.2878177-1-wanghai38@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600001.china.huawei.com (7.193.23.3) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return error code if usb_maxpacket() returns 0 in usbnet_probe(). Fixes: 397430b50a36 ("usbnet: sanity check for maxpacket") Reported-by: Hulk Robot Signed-off-by: Wang Hai --- drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 80432ee0ce69..fb5bf7d36d50 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1790,6 +1790,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); if (dev->maxpacket == 0) { /* that is a broken device */ + status = -EINVAL; goto out4; } -- 2.25.1