Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1442754pxb; Tue, 26 Oct 2021 09:05:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTSKQIm74NexcjuJdK2AG527BV+YuJeFnievytEHmuCunM/pjheZaVTcq1iYn8JCtfQ/VZ X-Received: by 2002:a17:90b:4a8d:: with SMTP id lp13mr30187661pjb.32.1635264328680; Tue, 26 Oct 2021 09:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635264328; cv=none; d=google.com; s=arc-20160816; b=Rfs01oVMFoFYU+zbEdkxsd6yXjsNzZOeNFv6T0y6CMBsM0wIwGRU/YuBZV9ueyKc40 1U7FdnKFpa6SJZTz0lUQnzG1syYL39pPV/R3rkkEMggiPjRcoqwl1GD83YGEd/IClViR VZVSZGgxYhABrVNqG3xuY5HcLAR4wdmQYT86SRf/8tl7jkzel56ObBGK8nJm3fLRoKCN BhqsyI4gKbfG29sQwdI8uxpT4kZZwDMlXqeh9UcgKdNbSdnqkwVp4Ce61/cjWMed3uBQ 2dTOGRM3bkPNg+b6GWc7rsUYAt+p4oyDpXqzVhGVeWivqWLRvaUB/hz6JBJbswGggapH hOsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=zR/KIUzKloKlx3EuRViG0gh8IJ65DCyc2kqUDgD+jlg=; b=xOMiolRGpIvViDcOecjNlxA3D8QWskFPZl0WTDMYZxp+TGx1mO/Xqc0ILYlfQcR4Ht xBfWnuagKcxmIeQePdfOJ0fkCw3doVDFW4B6Iqpi8I6OFHoyNIS0cUnSicHsoko/zdYn eGKIs3/HE6v5VTMdHwNduEOorjPPQ7xS7jcF/8dk1fKPKhBL78SnFbdPlEW7h/myNVbJ f35cCFXSARfrW/FeyRqoX4hQjqEsGfT+alCnvev1HuT7aHMTFh48ZpsQtxvDRBzAr5gf 5h24yf66rkwHZvzH3B5/VbrK6j8SjmWrmfgztqmOmuvSPhcgAWafoSMagSmvEjuquQ0g F2Vg== 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 e7si7399385pgi.36.2021.10.26.09.05.08; Tue, 26 Oct 2021 09:05:28 -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 S235174AbhJZMUF (ORCPT + 99 others); Tue, 26 Oct 2021 08:20:05 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:29939 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhJZMUF (ORCPT ); Tue, 26 Oct 2021 08:20:05 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HdrLh3x9dzbnFt; Tue, 26 Oct 2021 20:13:00 +0800 (CST) Received: from kwepemm600001.china.huawei.com (7.193.23.3) by dggemv704-chm.china.huawei.com (10.3.19.47) 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 20:17:38 +0800 Received: from [10.174.176.245] (10.174.176.245) 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 20:17:37 +0800 Subject: Re: [PATCH net] usbnet: fix error return code in usbnet_probe() To: Johan Hovold CC: , , , , , References: <20211026112526.2878177-1-wanghai38@huawei.com> From: "wanghai (M)" Message-ID: Date: Tue, 26 Oct 2021 20:17:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.245] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 ?? 2021/10/26 19:54, Johan Hovold ะด??: > On Tue, Oct 26, 2021 at 07:25:26PM +0800, Wang Hai wrote: >> 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 >> --- > Good catch. This is embarrassing. I double checked the error path but > failed to notice the missing return value. > >> 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; > But please use -ENODEV here. -EINVAL is typically reserved for bad user > input. Ok, I will send v2 >> goto out4; >> } > Johan > . > -- Wang Hai